diff options
author | Jean-Francois Brousseau <jfb@cvs.openbsd.org> | 2004-08-03 05:08:46 +0000 |
---|---|---|
committer | Jean-Francois Brousseau <jfb@cvs.openbsd.org> | 2004-08-03 05:08:46 +0000 |
commit | 6e990f22928e1eb514d3d458fa9120463b3459f5 (patch) | |
tree | e5c2e0eb38abae01c2d8e1ea70fb3019a5a0ad09 /usr.bin/cvs | |
parent | 2133ed3a801e38b1f9a43b5ed5961d66c94d10cb (diff) |
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')
-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) { |