Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/pkg_install/lib If symlink integrity check fails, t...



details:   https://anonhg.NetBSD.org/src/rev/4366de3aa8e0
branches:  trunk
changeset: 567130:4366de3aa8e0
user:      minskim <minskim%NetBSD.org@localhost>
date:      Tue Jun 01 16:15:31 2004 +0000

description:
If symlink integrity check fails, try the target of the symlink.  This
is needed when linkfarm creates a symlink to a symlink in the depot.
OK'ed by silence on tech-pkg@.

diffstat:

 usr.sbin/pkg_install/lib/plist.c |  26 +++++++++++++++++++-------
 1 files changed, 19 insertions(+), 7 deletions(-)

diffs (46 lines):

diff -r 726eee3fa7fb -r 4366de3aa8e0 usr.sbin/pkg_install/lib/plist.c
--- a/usr.sbin/pkg_install/lib/plist.c  Tue Jun 01 16:12:51 2004 +0000
+++ b/usr.sbin/pkg_install/lib/plist.c  Tue Jun 01 16:15:31 2004 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: plist.c,v 1.43 2004/05/10 19:59:59 kleink Exp $        */
+/*     $NetBSD: plist.c,v 1.44 2004/06/01 16:15:31 minskim Exp $       */
 
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static const char *rcsid = "from FreeBSD Id: plist.c,v 1.24 1997/10/08 07:48:15 charnier Exp";
 #else
-__RCSID("$NetBSD: plist.c,v 1.43 2004/05/10 19:59:59 kleink Exp $");
+__RCSID("$NetBSD: plist.c,v 1.44 2004/06/01 16:15:31 minskim Exp $");
 #endif
 #endif
 
@@ -397,11 +397,23 @@
                                                }
                                                buf[SymlinkHeaderLen + cc] = 0x0;
                                                if (strcmp(buf, p->next->name) != 0) {
-                                                       printf("symlink %s is not same as recorded value, %s: %s\n",
-                                                           buf, Force ? "deleting anyway" : "not deleting", tmp);
-                                                       if (!Force) {
-                                                               fail = FAIL;
-                                                               continue;
+                                                       if ((cc = readlink(&buf[SymlinkHeaderLen], &buf[SymlinkHeaderLen],
+                                                                 sizeof(buf) - SymlinkHeaderLen)) < 0) {
+                                                               printf("symlink %s is not same as recorded value, %s: %s\n",
+                                                                   buf, Force ? "deleting anyway" : "not deleting", tmp);
+                                                               if (!Force) {
+                                                                       fail = FAIL;
+                                                                       continue;
+                                                               }
+                                                       }
+                                                       buf[SymlinkHeaderLen + cc] = 0x0;
+                                                       if (strcmp(buf, p->next->name) != 0) {
+                                                               printf("symlink %s is not same as recorded value, %s: %s\n",
+                                                                   buf, Force ? "deleting anyway" : "not deleting", tmp);
+                                                               if (!Force) {
+                                                                       fail = FAIL;
+                                                                       continue;
+                                                               }
                                                        }
                                                }
                                        }



Home | Main Index | Thread Index | Old Index