Module Name:    src
Committed By:   soren
Date:           Wed Jul 31 22:37:55 UTC 2013

Modified Files:
        src/usr.sbin/catman: catman.c

Log Message:
Only try to recreate symlinks in the cat directory if they are local.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/usr.sbin/catman/catman.c

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

Modified files:

Index: src/usr.sbin/catman/catman.c
diff -u src/usr.sbin/catman/catman.c:1.34 src/usr.sbin/catman/catman.c:1.35
--- src/usr.sbin/catman/catman.c:1.34	Sat Dec 24 23:46:11 2011
+++ src/usr.sbin/catman/catman.c	Wed Jul 31 22:37:55 2013
@@ -1,4 +1,4 @@
-/*      $NetBSD: catman.c,v 1.34 2011/12/24 23:46:11 christos Exp $       */
+/*      $NetBSD: catman.c,v 1.35 2013/07/31 22:37:55 soren Exp $       */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -421,13 +421,19 @@ scanmandir(const char *catdir, const cha
 					continue;
 				}
 				buffer[len] = '\0';
-				bp = basename(buffer);
-				strlcpy(tmp, manpage, sizeof(tmp));
-				snprintf(manpage, sizeof(manpage), "%s/%s",
-				    dirname(tmp), bp);
-				strlcpy(tmp, catpage, sizeof(tmp));
-				snprintf(catpage, sizeof(catpage), "%s/%s",
-				    dirname(tmp), buffer);
+
+				if (strcmp(buffer, basename(buffer)) == 0) {
+					bp = basename(buffer);
+					strlcpy(tmp, manpage, sizeof(tmp));
+					snprintf(manpage, sizeof(manpage),
+					    "%s/%s", dirname(tmp), bp);
+					strlcpy(tmp, catpage, sizeof(tmp));
+					snprintf(catpage, sizeof(catpage),
+					    "%s/%s", dirname(tmp), buffer);
+				} else {
+					*linkname = '\0';
+				}
+
 			}
 			else
 				*linkname = '\0';

Reply via email to