diff options
author | 1996-06-20 10:46:01 +0000 | |
---|---|---|
committer | 1996-06-20 10:46:01 +0000 | |
commit | 679286fb397ce9f958cb48a2a8418bb01abeeecc (patch) | |
tree | 993cd7fb7771a0cbba482e3b6c1f58f75adc4e73 /lib/libutil | |
parent | add fdformat for the i386: based on an old FreeBSD version, gotten from (diff) | |
download | wireguard-openbsd-679286fb397ce9f958cb48a2a8418bb01abeeecc.tar.xz wireguard-openbsd-679286fb397ce9f958cb48a2a8418bb01abeeecc.zip |
only write to realpath if non-NULL
Diffstat (limited to 'lib/libutil')
-rw-r--r-- | lib/libutil/opendev.3 | 7 | ||||
-rw-r--r-- | lib/libutil/opendev.c | 11 |
2 files changed, 11 insertions, 7 deletions
diff --git a/lib/libutil/opendev.3 b/lib/libutil/opendev.3 index 1a495a2fc4c..70ee7181959 100644 --- a/lib/libutil/opendev.3 +++ b/lib/libutil/opendev.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: opendev.3,v 1.3 1996/06/18 09:13:41 downsj Exp $ +.\" $OpenBSD: opendev.3,v 1.4 1996/06/20 10:46:01 deraadt Exp $ .\" .\" Copyright (c) 1996, Jason Downs. All rights reserved. .\" @@ -59,8 +59,9 @@ OPENDEV_PART attempt to open the raw partition during expansion OPENDEV_DRCT attempt to open the device itself during expansion .Ed .Pp -.Ar Realpath -will be modified to point at the fully expanded device name. +If +.Ar realpath +is not NULL, it is modified to point at the fully expanded device name. .Pp .Sh RETURN VALUES The diff --git a/lib/libutil/opendev.c b/lib/libutil/opendev.c index 6603dc0791a..557b4e52ec7 100644 --- a/lib/libutil/opendev.c +++ b/lib/libutil/opendev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: opendev.c,v 1.2 1996/06/17 07:46:03 downsj Exp $ */ +/* $OpenBSD: opendev.c,v 1.3 1996/06/20 10:46:02 deraadt Exp $ */ /* * Copyright (c) 1996, Jason Downs. All rights reserved. @@ -48,7 +48,8 @@ opendev(path, oflags, dflags, realpath) int fd; static char namebuf[256]; - *realpath = path; + if (realpath) + *realpath = path; fd = open(path, oflags); if ((fd < 0) && (errno == ENOENT)) { @@ -70,7 +71,8 @@ opendev(path, oflags, dflags, realpath) fd = open(namebuf, oflags); } - *realpath = namebuf; + if (realpath) + *realpath = namebuf; } } if ((fd < 0) && (errno == ENOENT) && (path[0] != '/')) { @@ -78,7 +80,8 @@ opendev(path, oflags, dflags, realpath) _PATH_DEV, path); fd = open(namebuf, oflags); - *realpath = namebuf; + if (realpath) + *realpath = namebuf; } return (fd); |