diff --git a/src/lib/libutil/opendev.3 b/src/lib/libutil/opendev.3 index 1a495a2f..70ee7181 100644 --- a/src/lib/libutil/opendev.3 +++ b/src/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/src/lib/libutil/opendev.c b/src/lib/libutil/opendev.c index 6603dc07..557b4e52 100644 --- a/src/lib/libutil/opendev.c +++ b/src/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);