From 3c84ded68a9106ac87886e173e75dd3dde33c231 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Tue, 13 Dec 2005 11:35:31 +0000 Subject: Convert internal users of chmod/*stat*, minimize change for __strsep --- libc/misc/dirent/opendir.c | 2 +- libc/misc/glob/glob.c | 2 +- libc/misc/internals/__uClibc_main.c | 2 +- libc/misc/internals/tempname.c | 4 ++-- libc/misc/statfs/fstatfs64.c | 6 +++--- libc/misc/statfs/fstatvfs.c | 6 ++---- libc/misc/statfs/fstatvfs64.c | 6 ++---- libc/misc/statfs/internal_statvfs.c | 10 ++++++++-- libc/misc/statfs/statfs64.c | 6 ++++-- libc/misc/statfs/statvfs.c | 7 ++----- libc/misc/statfs/statvfs64.c | 6 ++---- libc/misc/sysvipc/ftok.c | 2 +- 12 files changed, 29 insertions(+), 30 deletions(-) (limited to 'libc/misc') diff --git a/libc/misc/dirent/opendir.c b/libc/misc/dirent/opendir.c index 5c9762f85..efa6daba6 100644 --- a/libc/misc/dirent/opendir.c +++ b/libc/misc/dirent/opendir.c @@ -18,7 +18,7 @@ DIR attribute_hidden *__opendir(const char *name) char *buf; DIR *ptr; - if (stat(name, &statbuf)) + if (__stat(name, &statbuf)) return NULL; if (!S_ISDIR(statbuf.st_mode)) { __set_errno(ENOTDIR); diff --git a/libc/misc/glob/glob.c b/libc/misc/glob/glob.c index d4a0b67ca..795030388 100644 --- a/libc/misc/glob/glob.c +++ b/libc/misc/glob/glob.c @@ -284,7 +284,7 @@ glob (pattern, flags, errfunc, pglob) int i; struct stat st; for (i = oldcount; i < pglob->gl_pathc; ++i) - if (lstat (pglob->gl_pathv[i], &st) == 0 && + if (__lstat (pglob->gl_pathv[i], &st) == 0 && S_ISDIR (st.st_mode)) __strcat (pglob->gl_pathv[i], "/"); } diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c index 618fad74c..3760ae275 100644 --- a/libc/misc/internals/__uClibc_main.c +++ b/libc/misc/internals/__uClibc_main.c @@ -96,7 +96,7 @@ static void __check_one_fd(int fd, int mode) /* /dev/null is major=1 minor=3. Make absolutely certain * that is in fact the device that we have opened and not * some other wierd file... */ - if ( (nullfd!=fd) || fstat(fd, &st) || !S_ISCHR(st.st_mode) || + if ( (nullfd!=fd) || __fstat(fd, &st) || !S_ISCHR(st.st_mode) || (st.st_rdev != makedev(1, 3))) { /* Somebody is trying some trickery here... */ diff --git a/libc/misc/internals/tempname.c b/libc/misc/internals/tempname.c index fae3687ad..5bcd78390 100644 --- a/libc/misc/internals/tempname.c +++ b/libc/misc/internals/tempname.c @@ -54,7 +54,7 @@ static int direxists (const char *dir) { struct stat buf; - return stat(dir, &buf) == 0 && S_ISDIR (buf.st_mode); + return __stat(dir, &buf) == 0 && S_ISDIR (buf.st_mode); } /* Path search algorithm, for tmpnam, tmpfile, etc. If DIR is @@ -212,7 +212,7 @@ int attribute_hidden __gen_tempname (char *tmpl, int kind) case __GT_NOCREATE: { struct stat st; - if (stat (tmpl, &st) < 0) + if (__stat (tmpl, &st) < 0) { if (errno == ENOENT) { diff --git a/libc/misc/statfs/fstatfs64.c b/libc/misc/statfs/fstatfs64.c index b793002fb..5fd1d60f6 100644 --- a/libc/misc/statfs/fstatfs64.c +++ b/libc/misc/statfs/fstatfs64.c @@ -41,11 +41,11 @@ #include /* Return information about the filesystem on which FD resides. */ -int fstatfs64 (int fd, struct statfs64 *buf) +int attribute_hidden __fstatfs64 (int fd, struct statfs64 *buf) { struct statfs buf32; - if (fstatfs (fd, &buf32) < 0) + if (__fstatfs (fd, &buf32) < 0) return -1; buf->f_type = buf32.f_type; @@ -61,6 +61,6 @@ int fstatfs64 (int fd, struct statfs64 *buf) return 0; } +strong_alias(__fstatfs64,fstatfs64) #endif /* __UCLIBC_HAS_LFS__ */ - diff --git a/libc/misc/statfs/fstatvfs.c b/libc/misc/statfs/fstatvfs.c index b79195e73..14ef6ecce 100644 --- a/libc/misc/statfs/fstatvfs.c +++ b/libc/misc/statfs/fstatvfs.c @@ -17,8 +17,6 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define strsep __strsep - #include #define __USE_GNU @@ -37,10 +35,10 @@ int fstatvfs (int fd, struct statvfs *buf) struct stat st; /* Get as much information as possible from the system. */ - if (fstatfs (fd, &fsbuf) < 0) + if (__fstatfs (fd, &fsbuf) < 0) return -1; -#define STAT(st) fstat (fd, st) +#define STAT(st) __fstat (fd, st) #include "internal_statvfs.c" /* We signal success if the statfs call succeeded. */ diff --git a/libc/misc/statfs/fstatvfs64.c b/libc/misc/statfs/fstatvfs64.c index 0d7416df3..993caf955 100644 --- a/libc/misc/statfs/fstatvfs64.c +++ b/libc/misc/statfs/fstatvfs64.c @@ -17,8 +17,6 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define strsep __strsep - #include #ifdef __UCLIBC_HAS_LFS__ @@ -50,10 +48,10 @@ int fstatvfs (int fd, struct statvfs *buf) struct stat st; /* Get as much information as possible from the system. */ - if (fstatfs (fd, &fsbuf) < 0) + if (__fstatfs (fd, &fsbuf) < 0) return -1; -#define STAT(st) fstat (fd, st) +#define STAT(st) __fstat (fd, st) #include "internal_statvfs.c" /* We signal success if the statfs call succeeded. */ diff --git a/libc/misc/statfs/internal_statvfs.c b/libc/misc/statfs/internal_statvfs.c index 4e25edc3f..d41c3052d 100644 --- a/libc/misc/statfs/internal_statvfs.c +++ b/libc/misc/statfs/internal_statvfs.c @@ -18,12 +18,18 @@ 02111-1307 USA. */ extern FILE *__setmntent (__const char *__file, __const char *__mode) __THROW attribute_hidden; + extern struct mntent *__getmntent_r (FILE *__restrict __stream, struct mntent *__restrict __result, char *__restrict __buffer, int __bufsize) __THROW attribute_hidden; + extern int __endmntent (FILE *__stream) __THROW attribute_hidden; +extern char *__strsep (char **__restrict __stringp, + __const char *__restrict __delim) + __THROW __nonnull ((1, 2)) attribute_hidden; + /* Now fill in the fields we have information for. */ buf->f_bsize = fsbuf.f_bsize; /* Linux does not support f_frsize, so set it to the full block size. */ @@ -77,7 +83,7 @@ extern int __endmntent (FILE *__stream) __THROW attribute_hidden; struct stat fsst; /* Find out about the device the current entry is for. */ - if (stat (mntbuf.mnt_dir, &fsst) >= 0 + if (__stat (mntbuf.mnt_dir, &fsst) >= 0 && st.st_dev == fsst.st_dev) { /* Bingo, we found the entry for the device FD is on. @@ -85,7 +91,7 @@ extern int __endmntent (FILE *__stream) __THROW attribute_hidden; char *cp = mntbuf.mnt_opts; char *opt; - while ((opt = strsep (&cp, ",")) != NULL) + while ((opt = __strsep (&cp, ",")) != NULL) if (__strcmp (opt, "ro") == 0) buf->f_flag |= ST_RDONLY; else if (__strcmp (opt, "nosuid") == 0) diff --git a/libc/misc/statfs/statfs64.c b/libc/misc/statfs/statfs64.c index 7144cce71..7a8f2bc36 100644 --- a/libc/misc/statfs/statfs64.c +++ b/libc/misc/statfs/statfs64.c @@ -39,11 +39,11 @@ #if defined __UCLIBC_HAS_LFS__ /* Return information about the filesystem on which FILE resides. */ -int statfs64 (const char *file, struct statfs64 *buf) +int attribute_hidden __statfs64 (const char *file, struct statfs64 *buf) { struct statfs buf32; - if (statfs (file, &buf32) < 0) + if (__statfs (file, &buf32) < 0) return -1; buf->f_type = buf32.f_type; @@ -59,4 +59,6 @@ int statfs64 (const char *file, struct statfs64 *buf) return 0; } +strong_alias(__statfs64,statfs64) + #endif diff --git a/libc/misc/statfs/statvfs.c b/libc/misc/statfs/statvfs.c index 0fe239573..a7c553fb6 100644 --- a/libc/misc/statfs/statvfs.c +++ b/libc/misc/statfs/statvfs.c @@ -17,8 +17,6 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define strsep __strsep - #include #define __USE_GNU @@ -31,17 +29,16 @@ #include #include - int statvfs (const char *file, struct statvfs *buf) { struct statfs fsbuf; struct stat st; /* Get as much information as possible from the system. */ - if (statfs (file, &fsbuf) < 0) + if (__statfs (file, &fsbuf) < 0) return -1; -#define STAT(st) stat (file, st) +#define STAT(st) __stat (file, st) #include "internal_statvfs.c" /* We signal success if the statfs call succeeded. */ diff --git a/libc/misc/statfs/statvfs64.c b/libc/misc/statfs/statvfs64.c index 8bacbba70..dc2458f5f 100644 --- a/libc/misc/statfs/statvfs64.c +++ b/libc/misc/statfs/statvfs64.c @@ -17,8 +17,6 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define strsep __strsep - #include #ifdef __UCLIBC_HAS_LFS__ @@ -51,10 +49,10 @@ int statvfs (const char *file, struct statvfs *buf) struct stat st; /* Get as much information as possible from the system. */ - if (statfs (file, &fsbuf) < 0) + if (__statfs (file, &fsbuf) < 0) return -1; -#define STAT(st) stat (file, st) +#define STAT(st) __stat (file, st) #include "internal_statvfs.c" /* We signal success if the statfs call succeeded. */ diff --git a/libc/misc/sysvipc/ftok.c b/libc/misc/sysvipc/ftok.c index 2bd8b2ec0..fd4021d3e 100644 --- a/libc/misc/sysvipc/ftok.c +++ b/libc/misc/sysvipc/ftok.c @@ -25,7 +25,7 @@ key_t ftok (const char *pathname, int proj_id) struct stat st; key_t key; - if (stat(pathname, &st) < 0) + if (__stat(pathname, &st) < 0) return (key_t) -1; key = ((st.st_ino & 0xffff) | ((st.st_dev & 0xff) << 16) -- cgit v1.2.3