Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/catman Only try to recreate symlinks in the cat dir...



details:   https://anonhg.NetBSD.org/src/rev/369cc086cf23
branches:  trunk
changeset: 788968:369cc086cf23
user:      soren <soren%NetBSD.org@localhost>
date:      Wed Jul 31 22:37:55 2013 +0000

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

diffstat:

 usr.sbin/catman/catman.c |  22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

diffs (36 lines):

diff -r a0f43a62daec -r 369cc086cf23 usr.sbin/catman/catman.c
--- a/usr.sbin/catman/catman.c  Wed Jul 31 21:01:13 2013 +0000
+++ b/usr.sbin/catman/catman.c  Wed Jul 31 22:37:55 2013 +0000
@@ -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 @@
                                        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';



Home | Main Index | Thread Index | Old Index