diff options
author | 2004-08-03 05:08:45 +0000 | |
---|---|---|
committer | 2004-08-03 05:08:45 +0000 | |
commit | 1f16a58b58939f1439bfd97464efa0d2988d4c1f (patch) | |
tree | 7e43c51bbd88ae66fbcfd6da847d1c6ffd1ab19f /usr.bin/cvs/resp.c | |
parent | Move all of the request- and response-specific handlers into separate (diff) | |
download | wireguard-openbsd-1f16a58b58939f1439bfd97464efa0d2988d4c1f.tar.xz wireguard-openbsd-1f16a58b58939f1439bfd97464efa0d2988d4c1f.zip |
When creating a file, set its last access and modification times to the
last timestamp received by the `Mod-time' command
Diffstat (limited to 'usr.bin/cvs/resp.c')
-rw-r--r-- | usr.bin/cvs/resp.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/usr.bin/cvs/resp.c b/usr.bin/cvs/resp.c index 1855084457f..6649d42a4e8 100644 --- a/usr.bin/cvs/resp.c +++ b/usr.bin/cvs/resp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: resp.c,v 1.1 2004/08/03 04:58:45 jfb Exp $ */ +/* $OpenBSD: resp.c,v 1.2 2004/08/03 05:08:45 jfb Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -27,6 +27,7 @@ #include <sys/types.h> #include <sys/stat.h> +#include <sys/time.h> #include <fcntl.h> #include <stdio.h> @@ -533,6 +534,7 @@ cvs_resp_updated(struct cvsroot *root, int type, char *line) BUF *fbuf; CVSENTRIES *ef; struct cvs_ent *ep; + struct timeval tv[2]; ep = NULL; @@ -544,7 +546,6 @@ cvs_resp_updated(struct cvsroot *root, int type, char *line) ep = cvs_ent_parse(path); if (ep == NULL) return (-1); - printf("adding entry `%s'\n", path); snprintf(path, sizeof(path), "%s%s", line, ep->ce_name); if (type == CVS_RESP_CREATED) { @@ -572,6 +573,13 @@ cvs_resp_updated(struct cvsroot *root, int type, char *line) cvs_buf_write(fbuf, path, fmode); + tv[0].tv_sec = (long)cvs_modtime; + tv[0].tv_usec = 0; + tv[1].tv_sec = (long)cvs_modtime; + tv[1].tv_usec = 0; + if (utimes(path, tv) == -1) + cvs_log(LP_ERRNO, "failed to set file timestamps"); + /* now see if there is a checksum */ if (cvs_fcksum != NULL) { if (cvs_cksum(path, cksum_buf, sizeof(cksum_buf)) < 0) { |