diff options
author | jilles <jilles@FreeBSD.org> | 2012-12-04 16:54:43 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2012-12-04 16:54:43 +0000 |
commit | 74acd0aa7d7396577a2cb30cb186ea86e8b8e03d (patch) | |
tree | b9bce15600f74c380492e2130b7df7a92525ebe9 | |
parent | cd58bea1d9b250240d49e089a47746f2a37bf3a7 (diff) | |
download | FreeBSD-src-74acd0aa7d7396577a2cb30cb186ea86e8b8e03d.zip FreeBSD-src-74acd0aa7d7396577a2cb30cb186ea86e8b8e03d.tar.gz |
libc: Use the new 'e' fopen() mode option to simplify fstab.c.
No functional change is intended.
-rw-r--r-- | lib/libc/gen/fstab.c | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/lib/libc/gen/fstab.c b/lib/libc/gen/fstab.c index b68db2e..6a77abd 100644 --- a/lib/libc/gen/fstab.c +++ b/lib/libc/gen/fstab.c @@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$"); #include <sys/stat.h> #include <errno.h> -#include <fcntl.h> #include <fstab.h> #include <paths.h> #include <stdio.h> @@ -255,8 +254,6 @@ getfsfile(const char *name) int setfsent(void) { - int fd; - if (_fs_fp) { rewind(_fs_fp); LineNo = 0; @@ -268,18 +265,11 @@ setfsent(void) else setfstab(getenv("PATH_FSTAB")); } - fd = _open(path_fstab, O_RDONLY | O_CLOEXEC); - if (fd == -1) { - error(errno); - return (0); - } - _fs_fp = fdopen(fd, "r"); - if (_fs_fp != NULL) { + if ((_fs_fp = fopen(path_fstab, "re")) != NULL) { LineNo = 0; return (1); } error(errno); - _close(fd); return (0); } |