Module Name:    src
Committed By:   kamil
Date:           Fri Jun 30 04:11:57 UTC 2017

Modified Files:
        src/bin/ksh: c_test.c config.h

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


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/bin/ksh/c_test.c
cvs rdiff -u -r1.51 -r1.52 src/bin/ksh/config.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/c_test.c
diff -u src/bin/ksh/c_test.c:1.7 src/bin/ksh/c_test.c:1.8
--- src/bin/ksh/c_test.c:1.7	Fri Jun 30 03:56:12 2017
+++ src/bin/ksh/c_test.c	Fri Jun 30 04:11:57 2017
@@ -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 @@ test_eval(te, op, opnd1, opnd2, do_eval)
 	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 @@ test_eaccess(pathx, mode)
 {
 	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

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.51 src/bin/ksh/config.h:1.52
--- src/bin/ksh/config.h:1.51	Fri Jun 30 03:56:12 2017
+++ src/bin/ksh/config.h	Fri Jun 30 04:11:57 2017
@@ -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"

Reply via email to