diff options
author | Peter S. Mazinger <ps.m@gmx.net> | 2005-12-13 11:35:31 +0000 |
---|---|---|
committer | Peter S. Mazinger <ps.m@gmx.net> | 2005-12-13 11:35:31 +0000 |
commit | 3c84ded68a9106ac87886e173e75dd3dde33c231 (patch) | |
tree | dcc90d017e2c77b98d3753d470adfa576d36149c | |
parent | 4d668e00b8c42aca5662f1d65496a97a507f583f (diff) |
Convert internal users of chmod/*stat*, minimize change for __strsep
-rw-r--r-- | libc/inet/rpc/rcmd.c | 4 | ||||
-rw-r--r-- | libc/inet/rpc/ruserpass.c | 4 | ||||
-rw-r--r-- | libc/misc/dirent/opendir.c | 2 | ||||
-rw-r--r-- | libc/misc/glob/glob.c | 2 | ||||
-rw-r--r-- | libc/misc/internals/__uClibc_main.c | 2 | ||||
-rw-r--r-- | libc/misc/internals/tempname.c | 4 | ||||
-rw-r--r-- | libc/misc/statfs/fstatfs64.c | 6 | ||||
-rw-r--r-- | libc/misc/statfs/fstatvfs.c | 6 | ||||
-rw-r--r-- | libc/misc/statfs/fstatvfs64.c | 6 | ||||
-rw-r--r-- | libc/misc/statfs/internal_statvfs.c | 10 | ||||
-rw-r--r-- | libc/misc/statfs/statfs64.c | 6 | ||||
-rw-r--r-- | libc/misc/statfs/statvfs.c | 7 | ||||
-rw-r--r-- | libc/misc/statfs/statvfs64.c | 6 | ||||
-rw-r--r-- | libc/misc/sysvipc/ftok.c | 2 | ||||
-rw-r--r-- | libc/stdlib/ptsname.c | 4 | ||||
-rw-r--r-- | libc/stdlib/unix_grantpt.c | 3 | ||||
-rw-r--r-- | libc/sysdeps/linux/common/fstat.c | 3 | ||||
-rw-r--r-- | libc/sysdeps/linux/common/getcwd.c | 8 | ||||
-rw-r--r-- | libc/sysdeps/linux/common/getdirname.c | 8 | ||||
-rw-r--r-- | libc/sysdeps/linux/common/stat.c | 3 | ||||
-rw-r--r-- | libc/termios/ttyname.c | 4 | ||||
-rw-r--r-- | libc/unistd/fpathconf.c | 6 | ||||
-rw-r--r-- | libc/unistd/pathconf.c | 6 | ||||
-rw-r--r-- | libc/unistd/usershell.c | 2 |
24 files changed, 58 insertions, 56 deletions
diff --git a/libc/inet/rpc/rcmd.c b/libc/inet/rpc/rcmd.c index c2eed87d4..36e942f9e 100644 --- a/libc/inet/rpc/rcmd.c +++ b/libc/inet/rpc/rcmd.c @@ -385,7 +385,7 @@ iruserfopen (char *file, uid_t okuser) root, if writeable by anyone but the owner, or if hardlinked anywhere, quit. */ cp = NULL; - if (lstat (file, &st)) + if (__lstat (file, &st)) cp = "lstat failed"; else if (!S_ISREG (st.st_mode)) cp = "not regular file"; @@ -394,7 +394,7 @@ iruserfopen (char *file, uid_t okuser) res = fopen (file, "r"); if (!res) cp = "cannot open"; - else if (fstat (fileno (res), &st) < 0) + else if (__fstat (fileno (res), &st) < 0) cp = "fstat failed"; else if (st.st_uid && st.st_uid != okuser) cp = "bad owner"; diff --git a/libc/inet/rpc/ruserpass.c b/libc/inet/rpc/ruserpass.c index b7bc36864..43291808d 100644 --- a/libc/inet/rpc/ruserpass.c +++ b/libc/inet/rpc/ruserpass.c @@ -182,7 +182,7 @@ next: break; case PASSWD: if (__strcmp(*aname, "anonymous") && - fstat(fileno(cfile), &stb) >= 0 && + __fstat(fileno(cfile), &stb) >= 0 && (stb.st_mode & 077) != 0) { __printf(_("Error: .netrc file is readable by others.")); __printf(_("Remove password or make file unreadable by others.")); @@ -201,7 +201,7 @@ next: break; case ACCOUNT: #if 0 - if (fstat(fileno(cfile), &stb) >= 0 + if (__fstat(fileno(cfile), &stb) >= 0 && (stb.st_mode & 077) != 0) { __printf("Error: .netrc file is readable by others."); __printf("Remove account or make file unreadable by others."); 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 <stddef.h> /* 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 <features.h> #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 <features.h> #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 <features.h> #define __USE_GNU @@ -31,17 +29,16 @@ #include <sys/statfs.h> #include <sys/statvfs.h> - 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 <features.h> #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) diff --git a/libc/stdlib/ptsname.c b/libc/stdlib/ptsname.c index c56f18a91..8e18e3989 100644 --- a/libc/stdlib/ptsname.c +++ b/libc/stdlib/ptsname.c @@ -136,7 +136,7 @@ int attribute_hidden __ptsname_r (int fd, char *buf, size_t buflen) return ERANGE; } - if (fstat (fd, &st) < 0) + if (__fstat (fd, &st) < 0) return errno; /* Check if FD really is a master pseudo terminal. */ @@ -165,7 +165,7 @@ int attribute_hidden __ptsname_r (int fd, char *buf, size_t buflen) p[2] = '\0'; } - if (stat(buf, &st) < 0) + if (__stat(buf, &st) < 0) return errno; /* Check if the name we're about to return really corresponds to a diff --git a/libc/stdlib/unix_grantpt.c b/libc/stdlib/unix_grantpt.c index e087d18c8..c8dbf3cb3 100644 --- a/libc/stdlib/unix_grantpt.c +++ b/libc/stdlib/unix_grantpt.c @@ -23,6 +23,7 @@ #define setrlimit __setrlimit #define waitpid __waitpid #define dup2 __dup2 +#define chmod __chmod #include <assert.h> #include <errno.h> @@ -119,7 +120,7 @@ grantpt (int fd) if (pts_name (fd, &buf, sizeof (_buf))) return -1; - if (stat(buf, &st) < 0) + if (__stat(buf, &st) < 0) goto cleanup; /* Make sure that we own the device. */ diff --git a/libc/sysdeps/linux/common/fstat.c b/libc/sysdeps/linux/common/fstat.c index 208227a7e..19d678b3a 100644 --- a/libc/sysdeps/linux/common/fstat.c +++ b/libc/sysdeps/linux/common/fstat.c @@ -31,5 +31,6 @@ int attribute_hidden __fstat(int fd, struct stat *buf) strong_alias(__fstat,fstat) #if ! defined __NR_fstat64 && defined __UCLIBC_HAS_LFS__ -weak_alias(fstat,fstat64) +hidden_strong_alias(__fstat,__fstat64) +weak_alias(__fstat,fstat64) #endif diff --git a/libc/sysdeps/linux/common/getcwd.c b/libc/sysdeps/linux/common/getcwd.c index 71134af09..c35e7f312 100644 --- a/libc/sysdeps/linux/common/getcwd.c +++ b/libc/sysdeps/linux/common/getcwd.c @@ -42,7 +42,7 @@ static char *search_dir(dev_t this_dev, ino_t this_ino, char *path_buf, int path int slow_search = (sizeof(ino_t) != sizeof(d->d_ino)); #endif - if (stat(path_buf, &st) < 0) { + if (__stat(path_buf, &st) < 0) { goto oops; } #ifdef FAST_DIR_SEARCH_POSSIBLE @@ -74,7 +74,7 @@ static char *search_dir(dev_t this_dev, ino_t this_ino, char *path_buf, int path goto oops; } __strcpy(ptr + 1, d->d_name); - if (stat(path_buf, &st) < 0) + if (__stat(path_buf, &st) < 0) continue; if (st.st_ino == this_ino && st.st_dev == this_dev) { closedir(dp); @@ -100,7 +100,7 @@ static char *recurser(char *path_buf, int path_size, dev_t root_dev, ino_t root_ dev_t this_dev; ino_t this_ino; - if (stat(path_buf, &st) < 0) { + if (__stat(path_buf, &st) < 0) { if (errno != EFAULT) goto oops; return 0; @@ -139,7 +139,7 @@ int __syscall_getcwd(char * buf, unsigned long size) len = -1; /* get stat for root to have a valid parameters for the terminating condition */ - if (stat("/", &st) < 0) { + if (__stat("/", &st) < 0) { /* root dir not found! */ return -1; } diff --git a/libc/sysdeps/linux/common/getdirname.c b/libc/sysdeps/linux/common/getdirname.c index d791f34a3..a4285322b 100644 --- a/libc/sysdeps/linux/common/getdirname.c +++ b/libc/sysdeps/linux/common/getdirname.c @@ -42,11 +42,11 @@ get_current_dir_name (void) pwd = __getenv ("PWD"); if (pwd != NULL #if defined __UCLIBC_HAS_LFS__ - && stat64 (".", &dotstat) == 0 - && stat64 (pwd, &pwdstat) == 0 + && __stat64 (".", &dotstat) == 0 + && __stat64 (pwd, &pwdstat) == 0 #else - && stat (".", &dotstat) == 0 - && stat (pwd, &pwdstat) == 0 + && __stat (".", &dotstat) == 0 + && __stat (pwd, &pwdstat) == 0 #endif && pwdstat.st_dev == dotstat.st_dev && pwdstat.st_ino == dotstat.st_ino) diff --git a/libc/sysdeps/linux/common/stat.c b/libc/sysdeps/linux/common/stat.c index cefbd5f8e..0abd345bc 100644 --- a/libc/sysdeps/linux/common/stat.c +++ b/libc/sysdeps/linux/common/stat.c @@ -31,5 +31,6 @@ int attribute_hidden __stat(const char *file_name, struct stat *buf) strong_alias(__stat,stat) #if ! defined __NR_stat64 && defined __UCLIBC_HAS_LFS__ -weak_alias(stat,stat64) +hidden_strong_alias(__stat,__stat64) +weak_alias(__stat,stat64) #endif diff --git a/libc/termios/ttyname.c b/libc/termios/ttyname.c index aa796c892..979694632 100644 --- a/libc/termios/ttyname.c +++ b/libc/termios/ttyname.c @@ -50,7 +50,7 @@ int attribute_hidden __ttyname_r(int fd, char *ubuf, size_t ubuflen) size_t len; char buf[TTYNAME_BUFLEN]; - if (fstat(fd, &st) < 0) { + if (__fstat(fd, &st) < 0) { return errno; } @@ -82,7 +82,7 @@ int attribute_hidden __ttyname_r(int fd, char *ubuf, size_t ubuflen) __strcpy(s, d->d_name); - if ((lstat(buf, &dst) == 0) + if ((__lstat(buf, &dst) == 0) #if 0 /* Stupid filesystems like cramfs fail to guarantee that * st_ino and st_dev uniquely identify a file, contrary to diff --git a/libc/unistd/fpathconf.c b/libc/unistd/fpathconf.c index 2f6cf7214..5404e7b01 100644 --- a/libc/unistd/fpathconf.c +++ b/libc/unistd/fpathconf.c @@ -53,7 +53,7 @@ long int fpathconf(int fd, int name) struct statfs fsbuf; /* Determine the filesystem type. */ - if (fstatfs (fd, &fsbuf) < 0) + if (__fstatfs (fd, &fsbuf) < 0) { if (errno == ENOSYS) /* not possible, return the default value. */ @@ -127,7 +127,7 @@ long int fpathconf(int fd, int name) struct statfs buf; int save_errno = errno; - if (fstatfs (fd, &buf) < 0) + if (__fstatfs (fd, &buf) < 0) { if (errno == ENOSYS) { @@ -201,7 +201,7 @@ long int fpathconf(int fd, int name) /* AIO is only allowed on regular files and block devices. */ struct stat st; - if (fstat (fd, &st) < 0 || (! S_ISREG (st.st_mode) && ! S_ISBLK (st.st_mode))) + if (__fstat (fd, &st) < 0 || (! S_ISREG (st.st_mode) && ! S_ISBLK (st.st_mode))) return -1; else return 1; diff --git a/libc/unistd/pathconf.c b/libc/unistd/pathconf.c index affec4e69..579b99be0 100644 --- a/libc/unistd/pathconf.c +++ b/libc/unistd/pathconf.c @@ -57,7 +57,7 @@ long int pathconf(const char *path, int name) struct statfs fsbuf; /* Determine the filesystem type. */ - if (statfs (path, &fsbuf) < 0) + if (__statfs (path, &fsbuf) < 0) { if (errno == ENOSYS) /* not possible, return the default value. */ @@ -131,7 +131,7 @@ long int pathconf(const char *path, int name) struct statfs buf; int save_errno = errno; - if (statfs (path, &buf) < 0) + if (__statfs (path, &buf) < 0) { if (errno == ENOSYS) { @@ -205,7 +205,7 @@ long int pathconf(const char *path, int name) /* AIO is only allowed on regular files and block devices. */ struct stat st; - if (stat (path, &st) < 0 || (! S_ISREG (st.st_mode) && ! S_ISBLK (st.st_mode))) + if (__stat (path, &st) < 0 || (! S_ISREG (st.st_mode) && ! S_ISBLK (st.st_mode))) return -1; else return 1; diff --git a/libc/unistd/usershell.c b/libc/unistd/usershell.c index 2e1f75d38..143dc2630 100644 --- a/libc/unistd/usershell.c +++ b/libc/unistd/usershell.c @@ -103,7 +103,7 @@ static char ** initshells(void) if ((fp = fopen(_PATH_SHELLS, "r")) == NULL) return (char **) validsh; - if (fstat(fileno(fp), &statb) == -1) { + if (__fstat(fileno(fp), &statb) == -1) { goto cleanup; } if ((strings = malloc((unsigned)statb.st_size + 1)) == NULL) { |