[Midnightbsd-cvs] src [11456] trunk/usr.bin/pathchk/pathchk.c: sync pathchk with freebsd

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sat Jul 7 12:50:18 EDT 2018


Revision: 11456
          http://svnweb.midnightbsd.org/src/?rev=11456
Author:   laffer1
Date:     2018-07-07 12:50:17 -0400 (Sat, 07 Jul 2018)
Log Message:
-----------
sync pathchk with freebsd

Modified Paths:
--------------
    trunk/usr.bin/pathchk/Makefile
    trunk/usr.bin/pathchk/pathchk.1
    trunk/usr.bin/pathchk/pathchk.c

Property Changed:
----------------
    trunk/usr.bin/pathchk/pathchk.1

Modified: trunk/usr.bin/pathchk/Makefile
===================================================================
--- trunk/usr.bin/pathchk/Makefile	2018-07-07 16:49:44 UTC (rev 11455)
+++ trunk/usr.bin/pathchk/Makefile	2018-07-07 16:50:17 UTC (rev 11456)
@@ -1,4 +1,5 @@
 # $MidnightBSD$
+# $FreeBSD: stable/10/usr.bin/pathchk/Makefile 97095 2002-05-22 10:30:16Z tjr $
 
 PROG=	pathchk
 

Modified: trunk/usr.bin/pathchk/pathchk.1
===================================================================
--- trunk/usr.bin/pathchk/pathchk.1	2018-07-07 16:49:44 UTC (rev 11455)
+++ trunk/usr.bin/pathchk/pathchk.1	2018-07-07 16:50:17 UTC (rev 11456)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2001, 2002 Chuck Rouillard
 .\" All rights reserved.
 .\"
@@ -25,7 +26,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/usr.bin/pathchk/pathchk.1 207485 2010-05-01 22:10:45Z jilles $
 .\"
 .Dd May 1, 2010
 .Dt PATHCHK 1


Property changes on: trunk/usr.bin/pathchk/pathchk.1
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/usr.bin/pathchk/pathchk.c
===================================================================
--- trunk/usr.bin/pathchk/pathchk.c	2018-07-07 16:49:44 UTC (rev 11455)
+++ trunk/usr.bin/pathchk/pathchk.c	2018-07-07 16:50:17 UTC (rev 11456)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2002 Tim J. Robbins.
  * All rights reserved.
@@ -33,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.bin/pathchk/pathchk.c 270890 2014-08-31 20:34:06Z jilles $");
 
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -98,7 +99,7 @@
 {
 	struct stat sb;
 	long complen, namemax, pathmax, svnamemax;
-	int badch, last;
+	int last;
 	char *end, *p, *pathd;
 
 	if ((pathd = strdup(path)) == NULL)
@@ -142,9 +143,9 @@
 			goto bad;
 		}
 
-		if (pflag && (badch = portable(p)) >= 0) {
+		if (pflag && !portable(p)) {
 			warnx("%s: %s: component contains non-portable "
-			    "character `%c'", path, p, badch);
+			    "character", path, p);
 			goto bad;
 		}
 
@@ -183,8 +184,7 @@
 }
 
 /*
- * Check whether a path component contains only portable characters. Return
- * the first non-portable character found.
+ * Check whether a path component contains only portable characters.
  */
 static int
 portable(const char *path)
@@ -197,7 +197,7 @@
 
 	s = strspn(path, charset);
 	if (path[s] != '\0')
-		return (path[s]);
+		return (0);
 
-	return (-1);
+	return (1);
 }



More information about the Midnightbsd-cvs mailing list