summaryrefslogtreecommitdiffstats
path: root/lib/libutil
diff options
context:
space:
mode:
authordownsj <downsj@openbsd.org>1996-12-04 21:25:33 +0000
committerdownsj <downsj@openbsd.org>1996-12-04 21:25:33 +0000
commit743807c4385e7d3990aaee620f5ae2d4d399fa7e (patch)
treebbe4abeba63452d492a8714bbb5c2eeb9913d7c4 /lib/libutil
parentuse TCSADRAIN instead of TCSANOW, to avoid dropping characters. (diff)
downloadwireguard-openbsd-743807c4385e7d3990aaee620f5ae2d4d399fa7e.tar.xz
wireguard-openbsd-743807c4385e7d3990aaee620f5ae2d4d399fa7e.zip
sanitize return value. NULL on failure, always.
Diffstat (limited to 'lib/libutil')
-rw-r--r--lib/libutil/readlabel.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libutil/readlabel.c b/lib/libutil/readlabel.c
index f78ce580cfc..803fbffce87 100644
--- a/lib/libutil/readlabel.c
+++ b/lib/libutil/readlabel.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: readlabel.c,v 1.1 1996/12/03 01:05:35 downsj Exp $ */
+/* $OpenBSD: readlabel.c,v 1.2 1996/12/04 21:25:33 downsj Exp $ */
/*
* Copyright (c) 1996, Jason Downs. All rights reserved.
@@ -48,7 +48,7 @@ char *readlabelfs(device)
char *device;
{
char rpath[MAXPATHLEN];
- char part;
+ char part, *type;
struct stat sbuf;
struct disklabel dk;
int fd;
@@ -111,5 +111,6 @@ char *readlabelfs(device)
return(NULL);
}
- return(fstypesnames[dk.d_partitions[part - 'a'].p_fstype]);
+ type = fstypesnames[dk.d_partitions[part - 'a'].p_fstype];
+ return((type[0] == '\0') ? NULL : type);
}