diff options
Diffstat (limited to '')
-rw-r--r-- | CMakeLists.txt | 12 | ||||
-rw-r--r-- | src/bltin/test.c | 38 | ||||
-rw-r--r-- | src/cd.c | 4 | ||||
-rw-r--r-- | src/exec.c | 6 | ||||
-rw-r--r-- | src/expand.c | 8 | ||||
-rw-r--r-- | src/input.c | 2 | ||||
-rw-r--r-- | src/jobs.c | 4 | ||||
-rw-r--r-- | src/mail.c | 4 | ||||
-rw-r--r-- | src/main.c | 4 | ||||
-rw-r--r-- | src/redir.c | 18 | ||||
-rw-r--r-- | src/var.c | 4 |
11 files changed, 46 insertions, 58 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 9fc4bc8..4871b35 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -114,18 +114,6 @@ if(HAVE_BSD_SIGNAL) add_compile_definitions(signal=bsd_signal) endif() -# Check for stat64 (dietlibc/klibc). -check_symbol_exists(stat64 "sys/stat.h" HAVE_STAT64) -if(NOT HAVE_STAT64) - add_compile_definitions(fstat64=fstat lstat64=lstat stat64=stat) -endif() - -# OS X apparently has stat64 but not open64. -check_symbol_exists(open64 "fcntl.h" HAVE_OPEN64) -if(NOT HAVE_OPEN64) - add_compile_definitions(open64=open readdir64=readdir dirent64=dirent) -endif() - # Check if struct stat has st_mtim. check_struct_has_member( "struct stat" "st_mtim.tv_sec" "sys/stat.h" HAVE_ST_MTIM diff --git a/src/bltin/test.c b/src/bltin/test.c index c7fc479..342ccdb 100644 --- a/src/bltin/test.c +++ b/src/bltin/test.c @@ -151,7 +151,7 @@ static int equalf(const char *, const char *); #ifdef HAVE_FACCESSAT static int test_file_access(const char *, int); #else -static int test_access(const struct stat64 *, int); +static int test_access(const struct stat *, int); #endif #ifdef HAVE_FACCESSAT @@ -388,9 +388,9 @@ binop(void) static int filstat(char *nm, enum token mode) { - struct stat64 s; + struct stat s; - if (mode == FILSYM ? lstat64(nm, &s) : stat64(nm, &s)) + if (mode == FILSYM ? lstat(nm, &s) : stat(nm, &s)) return 0; switch (mode) { @@ -473,17 +473,17 @@ static int isoperand(char **tp) static int newerf (const char *f1, const char *f2) { - struct stat64 b1, b2; + struct stat b1, b2; #ifdef HAVE_ST_MTIM - return (stat64(f1, &b1) == 0 && - stat64(f2, &b2) == 0 && + return (stat(f1, &b1) == 0 && + stat(f2, &b2) == 0 && ( b1.st_mtim.tv_sec > b2.st_mtim.tv_sec || (b1.st_mtim.tv_sec == b2.st_mtim.tv_sec && (b1.st_mtim.tv_nsec > b2.st_mtim.tv_nsec ))) ); #else - return (stat64(f1, &b1) == 0 && - stat64(f2, &b2) == 0 && + return (stat(f1, &b1) == 0 && + stat(f2, &b2) == 0 && b1.st_mtime > b2.st_mtime); #endif } @@ -491,17 +491,17 @@ newerf (const char *f1, const char *f2) static int olderf (const char *f1, const char *f2) { - struct stat64 b1, b2; + struct stat b1, b2; #ifdef HAVE_ST_MTIM - return (stat64(f1, &b1) == 0 && - stat64(f2, &b2) == 0 && + return (stat(f1, &b1) == 0 && + stat(f2, &b2) == 0 && (b1.st_mtim.tv_sec < b2.st_mtim.tv_sec || (b1.st_mtim.tv_sec == b2.st_mtim.tv_sec && (b1.st_mtim.tv_nsec < b2.st_mtim.tv_nsec ))) ); #else - return (stat64(f1, &b1) == 0 && - stat64(f2, &b2) == 0 && + return (stat(f1, &b1) == 0 && + stat(f2, &b2) == 0 && b1.st_mtime < b2.st_mtime); #endif } @@ -509,10 +509,10 @@ olderf (const char *f1, const char *f2) static int equalf (const char *f1, const char *f2) { - struct stat64 b1, b2; + struct stat b1, b2; - return (stat64(f1, &b1) == 0 && - stat64(f2, &b2) == 0 && + return (stat(f1, &b1) == 0 && + stat(f2, &b2) == 0 && b1.st_dev == b2.st_dev && b1.st_ino == b2.st_ino); } @@ -520,9 +520,9 @@ equalf (const char *f1, const char *f2) #ifdef HAVE_FACCESSAT static int has_exec_bit_set(const char *path) { - struct stat64 st; + struct stat st; - if (stat64(path, &st)) + if (stat(path, &st)) return 0; return st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH); } @@ -657,7 +657,7 @@ static int test_file_access(const char *path, int mode) * (euid==uid&&egid==gid), but uses st_mode for '-x' iff running as root. * i.e. it does strictly conform to 1003.1-2001 (and presumably 1003.2b). */ -static int test_access(const struct stat64 *sp, int stmode) +static int test_access(const struct stat *sp, int stmode) { gid_t *groups; register int n; diff --git a/src/cd.c b/src/cd.c index 1ef1dc5..b6742af 100644 --- a/src/cd.c +++ b/src/cd.c @@ -96,7 +96,7 @@ cdcmd(int argc, char **argv) const char *path; const char *p; char c; - struct stat64 statb; + struct stat statb; int flags; int len; @@ -132,7 +132,7 @@ dotdot: c = *p; p = stalloc(len); - if (stat64(p, &statb) >= 0 && S_ISDIR(statb.st_mode)) { + if (stat(p, &statb) >= 0 && S_ISDIR(statb.st_mode)) { if (c && c != ':') flags |= CD_PRINT; docd: diff --git a/src/exec.c b/src/exec.c index 87354d4..41d772f 100644 --- a/src/exec.c +++ b/src/exec.c @@ -333,7 +333,7 @@ find_command(char *name, struct cmdentry *entry, int act, const char *path) int idx; int prev; char *fullname; - struct stat64 statb; + struct stat statb; int e; int updatetbl; struct builtincmd *bcmd; @@ -343,7 +343,7 @@ find_command(char *name, struct cmdentry *entry, int act, const char *path) if (strchr(name, '/') != NULL) { entry->u.index = -1; if (act & DO_ABS) { - while (stat64(name, &statb) < 0) { + while (stat(name, &statb) < 0) { #ifdef SYSV if (errno == EINTR) continue; @@ -436,7 +436,7 @@ loop: TRACE(("searchexec \"%s\": no change\n", name)); goto success; } - while (stat64(fullname, &statb) < 0) { + while (stat(fullname, &statb) < 0) { #ifdef SYSV if (errno == EINTR) continue; diff --git a/src/expand.c b/src/expand.c index 1730670..623b4ce 100644 --- a/src/expand.c +++ b/src/expand.c @@ -1282,9 +1282,9 @@ expmeta(char *name, unsigned name_len, unsigned expdir_len) char *start; char *endname; int metaflag; - struct stat64 statb; + struct stat statb; DIR *dirp; - struct dirent64 *dp; + struct dirent *dp; int atend; int matchdot; int esc; @@ -1327,7 +1327,7 @@ expmeta(char *name, unsigned name_len, unsigned expdir_len) p++; *enddir++ = *p; } while (*p++); - if (lstat64(expdir, &statb) >= 0) + if (lstat(expdir, &statb) >= 0) addfname(expdir); return; } @@ -1361,7 +1361,7 @@ expmeta(char *name, unsigned name_len, unsigned expdir_len) p++; if (*p == '.') matchdot++; - while (! int_pending() && (dp = readdir64(dirp)) != NULL) { + while (! int_pending() && (dp = readdir(dirp)) != NULL) { if (dp->d_name[0] == '.' && ! matchdot) continue; if (pmatch(start, dp->d_name)) { diff --git a/src/input.c b/src/input.c index 4167bd1..bddc3f6 100644 --- a/src/input.c +++ b/src/input.c @@ -389,7 +389,7 @@ setinputfile(const char *fname, int flags) int fd; INTOFF; - if ((fd = open64(fname, O_RDONLY)) < 0) { + if ((fd = open(fname, O_RDONLY)) < 0) { if (flags & INPUT_NOFILE_OK) goto out; exitstatus = 127; diff --git a/src/jobs.c b/src/jobs.c index 8fb9d4b..4b90918 100644 --- a/src/jobs.c +++ b/src/jobs.c @@ -197,7 +197,7 @@ setjobctl(int on) return; if (on) { int ofd; - ofd = fd = open64(_PATH_TTY, O_RDWR); + ofd = fd = open(_PATH_TTY, O_RDWR); if (fd < 0) { fd += 3; while (!isatty(fd)) @@ -888,7 +888,7 @@ static void forkchild(struct job *jp, union node *n, int mode) ignoresig(SIGQUIT); if (jp->nprocs == 0) { close(0); - if (open64(_PATH_DEVNULL, O_RDONLY) != 0) + if (open(_PATH_DEVNULL, O_RDONLY) != 0) sh_error("Can't open %s", _PATH_DEVNULL); } } diff --git a/src/mail.c b/src/mail.c index a657153..71cbafd 100644 --- a/src/mail.c +++ b/src/mail.c @@ -70,7 +70,7 @@ chkmail(void) char *q; off_t *msp; struct stackmark smark; - struct stat64 statb; + struct stat statb; setstackmark(&smark); mpath = mpathset() ? mpathval() : mailval(); @@ -89,7 +89,7 @@ chkmail(void) abort(); #endif q[-1] = '\0'; /* delete trailing '/' */ - if (stat64(p, &statb) < 0) { + if (stat(p, &statb) < 0) { *msp = 0; continue; } diff --git a/src/main.c b/src/main.c index 7a28534..36431fc 100644 --- a/src/main.c +++ b/src/main.c @@ -298,7 +298,7 @@ find_dot_file(char *basename) { char *fullname; const char *path = pathval(); - struct stat64 statb; + struct stat statb; int len; /* don't try this for absolute or relative paths */ @@ -308,7 +308,7 @@ find_dot_file(char *basename) while ((len = padvance(&path, basename)) >= 0) { fullname = stackblock(); if ((!pathopt || *pathopt == 'f') && - !stat64(fullname, &statb) && S_ISREG(statb.st_mode)) { + !stat(fullname, &statb) && S_ISREG(statb.st_mode)) { /* This will be freed by the caller. */ return stalloc(len); } diff --git a/src/redir.c b/src/redir.c index 895140c..1e00a69 100644 --- a/src/redir.c +++ b/src/redir.c @@ -183,32 +183,32 @@ redirect(union node *redir, int flags) STATIC int openredirect(union node *redir) { - struct stat64 sb; + struct stat sb; char *fname; int f; switch (redir->nfile.type) { case NFROM: fname = redir->nfile.expfname; - if ((f = open64(fname, O_RDONLY)) < 0) + if ((f = open(fname, O_RDONLY)) < 0) goto eopen; break; case NFROMTO: fname = redir->nfile.expfname; - if ((f = open64(fname, O_RDWR|O_CREAT, 0666)) < 0) + if ((f = open(fname, O_RDWR|O_CREAT, 0666)) < 0) goto ecreate; break; case NTO: /* Take care of noclobber mode. */ if (Cflag) { fname = redir->nfile.expfname; - if (stat64(fname, &sb) < 0) { - if ((f = open64(fname, O_WRONLY|O_CREAT|O_EXCL, 0666)) < 0) + if (stat(fname, &sb) < 0) { + if ((f = open(fname, O_WRONLY|O_CREAT|O_EXCL, 0666)) < 0) goto ecreate; } else if (!S_ISREG(sb.st_mode)) { - if ((f = open64(fname, O_WRONLY, 0666)) < 0) + if ((f = open(fname, O_WRONLY, 0666)) < 0) goto ecreate; - if (!fstat64(f, &sb) && S_ISREG(sb.st_mode)) { + if (!fstat(f, &sb) && S_ISREG(sb.st_mode)) { close(f); errno = EEXIST; goto ecreate; @@ -222,12 +222,12 @@ openredirect(union node *redir) /* FALLTHROUGH */ case NCLOBBER: fname = redir->nfile.expfname; - if ((f = open64(fname, O_WRONLY|O_CREAT|O_TRUNC, 0666)) < 0) + if ((f = open(fname, O_WRONLY|O_CREAT|O_TRUNC, 0666)) < 0) goto ecreate; break; case NAPPEND: fname = redir->nfile.expfname; - if ((f = open64(fname, O_WRONLY|O_CREAT|O_APPEND, 0666)) < 0) + if ((f = open(fname, O_WRONLY|O_CREAT|O_APPEND, 0666)) < 0) goto ecreate; break; case NTOFD: diff --git a/src/var.c b/src/var.c index ca9504e..1729f49 100644 --- a/src/var.c +++ b/src/var.c @@ -127,7 +127,7 @@ INIT { char **envp; static char ppid[32] = "PPID="; const char *p; - struct stat64 st1, st2; + struct stat st1, st2; initvar(); for (envp = environ ; *envp ; envp++) { @@ -145,7 +145,7 @@ INIT { p = lookupvar("PWD"); if (p) - if (*p != '/' || stat64(p, &st1) || stat64(".", &st2) || + if (*p != '/' || stat(p, &st1) || stat(".", &st2) || st1.st_dev != st2.st_dev || st1.st_ino != st2.st_ino) p = 0; setpwd(p, 0); |