Date: Tue, 4 Dec 2012 16:54:44 +0000 (UTC) From: Jilles Tjoelker <jilles@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243865 - head/lib/libc/gen Message-ID: <201212041654.qB4GsiGB037557@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jilles Date: Tue Dec 4 16:54:43 2012 New Revision: 243865 URL: http://svnweb.freebsd.org/changeset/base/243865 Log: libc: Use the new 'e' fopen() mode option to simplify fstab.c. No functional change is intended. Modified: head/lib/libc/gen/fstab.c Modified: head/lib/libc/gen/fstab.c ============================================================================== --- head/lib/libc/gen/fstab.c Tue Dec 4 14:36:01 2012 (r243864) +++ head/lib/libc/gen/fstab.c Tue Dec 4 16:54:43 2012 (r243865) @@ -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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201212041654.qB4GsiGB037557>