Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/xinstall Auso support -h hash for hard-linked files.



details:   https://anonhg.NetBSD.org/src/rev/b581f4c0f15c
branches:  trunk
changeset: 558164:b581f4c0f15c
user:      lukem <lukem%NetBSD.org@localhost>
date:      Fri Jan 30 01:38:25 2004 +0000

description:
Auso support -h hash for hard-linked files.

diffstat:

 usr.bin/xinstall/xinstall.c |  21 ++++++++++++++++++---
 1 files changed, 18 insertions(+), 3 deletions(-)

diffs (49 lines):

diff -r 3a54767b72a4 -r b581f4c0f15c usr.bin/xinstall/xinstall.c
--- a/usr.bin/xinstall/xinstall.c       Thu Jan 29 22:19:12 2004 +0000
+++ b/usr.bin/xinstall/xinstall.c       Fri Jan 30 01:38:25 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xinstall.c,v 1.84 2004/01/29 07:58:33 lukem Exp $      */
+/*     $NetBSD: xinstall.c,v 1.85 2004/01/30 01:38:25 lukem Exp $      */
 
 /*
  * Copyright (c) 1987, 1993
@@ -46,7 +46,7 @@
 #if 0
 static char sccsid[] = "@(#)xinstall.c 8.1 (Berkeley) 7/21/93";
 #else
-__RCSID("$NetBSD: xinstall.c,v 1.84 2004/01/29 07:58:33 lukem Exp $");
+__RCSID("$NetBSD: xinstall.c,v 1.85 2004/01/30 01:38:25 lukem Exp $");
 #endif
 #endif /* not lint */
 
@@ -465,6 +465,7 @@
                                        /* XXX: only metalog hardlinked files */
                                int omode;
                                char *oowner, *ogroup, *offlags;
+                               char *dres;
 
                                        /* XXX: use underlying perms */
                                omode = mode;
@@ -475,7 +476,21 @@
                                group = NULL;
                                offlags = fflags;
                                fflags = NULL;
-                               metadata_log(to_name, "file", NULL, NULL, NULL);
+                               switch (digesttype) {
+                               case DIGEST_MD5:
+                                       dres = MD5File(from_name, NULL);
+                                       break;
+                               case DIGEST_RMD160:
+                                       dres = RMD160File(from_name, NULL);
+                                       break;
+                               case DIGEST_SHA1:
+                                       dres = SHA1File(from_name, NULL);
+                                       break;
+                               default:
+                                       dres = NULL;
+                               }
+                               metadata_log(to_name, "file", NULL, NULL, dres);
+                               free(dres);
                                mode = omode;
                                owner = oowner;
                                group = ogroup;



Home | Main Index | Thread Index | Old Index