Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/bin/ksh ksh: Drop support for OSes that don't map /dev/fd



details:   https://anonhg.NetBSD.org/src/rev/f67696211d6c
branches:  trunk
changeset: 825103:f67696211d6c
user:      kamil <kamil%NetBSD.org@localhost>
date:      Fri Jun 30 04:11:57 2017 +0000

description:
ksh: Drop support for OSes that don't map /dev/fd

diffstat:

 bin/ksh/c_test.c |  28 ++--------------------------
 bin/ksh/config.h |   5 +----
 2 files changed, 3 insertions(+), 30 deletions(-)

diffs (80 lines):

diff -r 2235933600aa -r f67696211d6c bin/ksh/c_test.c
--- a/bin/ksh/c_test.c  Fri Jun 30 04:01:48 2017 +0000
+++ b/bin/ksh/c_test.c  Fri Jun 30 04:11:57 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: c_test.c,v 1.7 2017/06/30 03:56:12 kamil Exp $ */
+/*     $NetBSD: c_test.c,v 1.8 2017/06/30 04:11:57 kamil Exp $ */
 
 /*
  * test(1); version 7-like  --  author Erik Baalbergen
@@ -11,7 +11,7 @@
 #include <sys/cdefs.h>
 
 #ifndef lint
-__RCSID("$NetBSD: c_test.c,v 1.7 2017/06/30 03:56:12 kamil Exp $");
+__RCSID("$NetBSD: c_test.c,v 1.8 2017/06/30 04:11:57 kamil Exp $");
 #endif
 
 #include <sys/stat.h>
@@ -422,19 +422,11 @@
        return 1;
 }
 
-/* Nasty kludge to handle Korn's bizarre /dev/fd hack */
 static int
 test_stat(pathx, statb)
        const char *pathx;
        struct stat *statb;
 {
-#if !defined(HAVE_DEV_FD)
-       int fd;
-
-       if (strncmp(pathx, "/dev/fd/", 8) == 0 && getn(pathx + 8, &fd))
-               return fstat(fd, statb);
-#endif /* !HAVE_DEV_FD */
-
        return stat(pathx, statb);
 }
 
@@ -448,22 +440,6 @@
 {
        int res;
 
-#if !defined(HAVE_DEV_FD)
-       int fd;
-
-       /* Note: doesn't handle //dev/fd, etc.. (this is ok) */
-       if (strncmp(pathx, "/dev/fd/", 8) == 0 && getn(pathx + 8, &fd)) {
-               int flags;
-
-               if ((flags = fcntl(fd, F_GETFL, 0)) < 0
-                   || (mode & X_OK)
-                   || ((mode & W_OK) && (flags & O_ACCMODE) == O_RDONLY)
-                   || ((mode & R_OK) && (flags & O_ACCMODE) == O_WRONLY))
-                       return -1;
-               return 0;
-       }
-#endif /* !HAVE_DEV_FD */
-
        res = eaccess(pathx, mode);
        /*
         * On most (all?) unixes, access() says everything is executable for
diff -r 2235933600aa -r f67696211d6c bin/ksh/config.h
--- a/bin/ksh/config.h  Fri Jun 30 04:01:48 2017 +0000
+++ b/bin/ksh/config.h  Fri Jun 30 04:11:57 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: config.h,v 1.51 2017/06/30 03:56:12 kamil Exp $        */
+/*     $NetBSD: config.h,v 1.52 2017/06/30 04:11:57 kamil Exp $        */
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -69,9 +69,6 @@
 /* Define if the pgrp of setpgrp() can't be the pid of a zombie process */
 /* #undef NEED_PGRP_SYNC */
 
-/* Define if your OS maps references to /dev/fd/n to file descriptor n */
-#define HAVE_DEV_FD 1
-
 /* Default PATH */
 #ifdef RESCUEDIR
 #define DEFAULT_PATH RESCUEDIR ":/bin:/usr/bin:/sbin:/usr/sbin"



Home | Main Index | Thread Index | Old Index