| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: xinstall.c,v 1.116 2014/07/06 20:50:03 apb Exp $ */ | | 1 | /* $NetBSD: xinstall.c,v 1.117 2014/07/06 20:54:47 apb Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1987, 1993 | | 4 | * Copyright (c) 1987, 1993 |
5 | * The Regents of the University of California. All rights reserved. | | 5 | * The Regents of the University of California. All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -36,27 +36,27 @@ | | | @@ -36,27 +36,27 @@ |
36 | #define HAVE_STRUCT_STAT_ST_FLAGS 1 | | 36 | #define HAVE_STRUCT_STAT_ST_FLAGS 1 |
37 | #endif | | 37 | #endif |
38 | | | 38 | |
39 | #include <sys/cdefs.h> | | 39 | #include <sys/cdefs.h> |
40 | #if defined(__COPYRIGHT) && !defined(lint) | | 40 | #if defined(__COPYRIGHT) && !defined(lint) |
41 | __COPYRIGHT("@(#) Copyright (c) 1987, 1993\ | | 41 | __COPYRIGHT("@(#) Copyright (c) 1987, 1993\ |
42 | The Regents of the University of California. All rights reserved."); | | 42 | The Regents of the University of California. All rights reserved."); |
43 | #endif /* not lint */ | | 43 | #endif /* not lint */ |
44 | | | 44 | |
45 | #if defined(__RCSID) && !defined(lint) | | 45 | #if defined(__RCSID) && !defined(lint) |
46 | #if 0 | | 46 | #if 0 |
47 | static char sccsid[] = "@(#)xinstall.c 8.1 (Berkeley) 7/21/93"; | | 47 | static char sccsid[] = "@(#)xinstall.c 8.1 (Berkeley) 7/21/93"; |
48 | #else | | 48 | #else |
49 | __RCSID("$NetBSD: xinstall.c,v 1.116 2014/07/06 20:50:03 apb Exp $"); | | 49 | __RCSID("$NetBSD: xinstall.c,v 1.117 2014/07/06 20:54:47 apb Exp $"); |
50 | #endif | | 50 | #endif |
51 | #endif /* not lint */ | | 51 | #endif /* not lint */ |
52 | | | 52 | |
53 | #define __MKTEMP_OK__ /* All uses of mktemp have been checked */ | | 53 | #define __MKTEMP_OK__ /* All uses of mktemp have been checked */ |
54 | #include <sys/param.h> | | 54 | #include <sys/param.h> |
55 | #include <sys/mman.h> | | 55 | #include <sys/mman.h> |
56 | #include <sys/stat.h> | | 56 | #include <sys/stat.h> |
57 | #include <sys/wait.h> | | 57 | #include <sys/wait.h> |
58 | #include <sys/time.h> | | 58 | #include <sys/time.h> |
59 | | | 59 | |
60 | #include <ctype.h> | | 60 | #include <ctype.h> |
61 | #include <err.h> | | 61 | #include <err.h> |
62 | #include <errno.h> | | 62 | #include <errno.h> |
| @@ -1192,30 +1192,30 @@ metadata_log(const char *path, const cha | | | @@ -1192,30 +1192,30 @@ metadata_log(const char *path, const cha |
1192 | fprintf(metafp, ".%s%s type=%s", *p ? "/" : "", p, type); | | 1192 | fprintf(metafp, ".%s%s type=%s", *p ? "/" : "", p, type); |
1193 | if (owner) | | 1193 | if (owner) |
1194 | fprintf(metafp, " uname=%s", owner); | | 1194 | fprintf(metafp, " uname=%s", owner); |
1195 | if (group) | | 1195 | if (group) |
1196 | fprintf(metafp, " gname=%s", group); | | 1196 | fprintf(metafp, " gname=%s", group); |
1197 | fprintf(metafp, " mode=%#o", mode); | | 1197 | fprintf(metafp, " mode=%#o", mode); |
1198 | if (slink) { | | 1198 | if (slink) { |
1199 | strsvis(buf, slink, VIS_CSTYLE, extra); /* encode link */ | | 1199 | strsvis(buf, slink, VIS_CSTYLE, extra); /* encode link */ |
1200 | fprintf(metafp, " link=%s", buf); | | 1200 | fprintf(metafp, " link=%s", buf); |
1201 | } | | 1201 | } |
1202 | if (*type == 'f') /* type=file */ | | 1202 | if (*type == 'f') /* type=file */ |
1203 | fprintf(metafp, " size=%lld", (long long)size); | | 1203 | fprintf(metafp, " size=%lld", (long long)size); |
1204 | if (tv != NULL && dopreserve) | | 1204 | if (tv != NULL && dopreserve) |
1205 | fprintf(metafp, " time=%lld.%0*ld", | | 1205 | fprintf(metafp, " time=%lld.%0*lld", |
1206 | (long long)tv[1].tv_sec, | | 1206 | (long long)tv[1].tv_sec, |
1207 | (tv[1].tv_usec == 0 ? 1 : 9), | | 1207 | (tv[1].tv_usec == 0 ? 1 : 9), |
1208 | (long)tv[1].tv_usec); | | 1208 | (long long)tv[1].tv_usec * 1000); |
1209 | if (digestresult && digest) | | 1209 | if (digestresult && digest) |
1210 | fprintf(metafp, " %s=%s", digest, digestresult); | | 1210 | fprintf(metafp, " %s=%s", digest, digestresult); |
1211 | if (fflags) | | 1211 | if (fflags) |
1212 | fprintf(metafp, " flags=%s", fflags); | | 1212 | fprintf(metafp, " flags=%s", fflags); |
1213 | if (tags) | | 1213 | if (tags) |
1214 | fprintf(metafp, " tags=%s", tags); | | 1214 | fprintf(metafp, " tags=%s", tags); |
1215 | fputc('\n', metafp); | | 1215 | fputc('\n', metafp); |
1216 | fflush(metafp); /* flush output */ | | 1216 | fflush(metafp); /* flush output */ |
1217 | /* unlock log file */ | | 1217 | /* unlock log file */ |
1218 | metalog_lock.l_type = F_UNLCK; | | 1218 | metalog_lock.l_type = F_UNLCK; |
1219 | if (fcntl(fileno(metafp), F_SETLKW, &metalog_lock) == -1) { | | 1219 | if (fcntl(fileno(metafp), F_SETLKW, &metalog_lock) == -1) { |
1220 | warn("can't unlock %s", metafile); | | 1220 | warn("can't unlock %s", metafile); |
1221 | } | | 1221 | } |