diff options
author | 1996-12-04 21:25:33 +0000 | |
---|---|---|
committer | 1996-12-04 21:25:33 +0000 | |
commit | 743807c4385e7d3990aaee620f5ae2d4d399fa7e (patch) | |
tree | bbe4abeba63452d492a8714bbb5c2eeb9913d7c4 /lib/libutil | |
parent | use TCSADRAIN instead of TCSANOW, to avoid dropping characters. (diff) | |
download | wireguard-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.c | 7 |
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); } |