diff options
author | Jason Downs <downsj@cvs.openbsd.org> | 1996-12-04 21:25:34 +0000 |
---|---|---|
committer | Jason Downs <downsj@cvs.openbsd.org> | 1996-12-04 21:25:34 +0000 |
commit | 3b6b1e8aed52466fed87e79c6525efccedc45ad3 (patch) | |
tree | 2005e3b6e83e07410843efc3d68dbc673e28d063 /lib | |
parent | 9253b7fe5036900e5d86b492cb030eee0727af50 (diff) |
sanitize return value. NULL on failure, always.
Diffstat (limited to 'lib')
-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); } |