summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Lai <ray@cvs.openbsd.org>2006-07-08 09:25:45 +0000
committerRay Lai <ray@cvs.openbsd.org>2006-07-08 09:25:45 +0000
commit907fb5cd814439ccc648628c99c54afd91ddf3e2 (patch)
tree6b511f331b9418ed0a9e41e746ce872b2622d119
parentd8aaf277a540b3ac999a3d657ca6fbe490f9f53d (diff)
Remove file mode argument from {cvs|rcs}_buf_write_stmp(). We
always set the temporary file to mode 600, which is already done by mkstemp(). OK joris@ and xsa@ over a month ago.
-rw-r--r--usr.bin/cvs/buf.c8
-rw-r--r--usr.bin/cvs/buf.h4
-rw-r--r--usr.bin/cvs/commit.c6
-rw-r--r--usr.bin/cvs/diff.c6
-rw-r--r--usr.bin/cvs/diff3.c14
-rw-r--r--usr.bin/cvs/import.c6
-rw-r--r--usr.bin/cvs/rcs.c6
-rw-r--r--usr.bin/rcs/buf.c8
-rw-r--r--usr.bin/rcs/buf.h4
-rw-r--r--usr.bin/rcs/ci.c6
-rw-r--r--usr.bin/rcs/diff3.c24
-rw-r--r--usr.bin/rcs/rcs.c6
-rw-r--r--usr.bin/rcs/rcsdiff.c10
13 files changed, 50 insertions, 58 deletions
diff --git a/usr.bin/cvs/buf.c b/usr.bin/cvs/buf.c
index 92bf9ccb65d..4f19552a752 100644
--- a/usr.bin/cvs/buf.c
+++ b/usr.bin/cvs/buf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: buf.c,v 1.54 2006/06/14 14:10:50 joris Exp $ */
+/* $OpenBSD: buf.c,v 1.55 2006/07/08 09:25:44 ray Exp $ */
/*
* Copyright (c) 2003 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -374,7 +374,7 @@ cvs_buf_write(BUF *b, const char *path, mode_t mode)
* <template>, as per mkstemp
*/
void
-cvs_buf_write_stmp(BUF *b, char *template, mode_t mode, struct timeval *tv)
+cvs_buf_write_stmp(BUF *b, char *template, struct timeval *tv)
{
int fd;
@@ -386,10 +386,6 @@ cvs_buf_write_stmp(BUF *b, char *template, mode_t mode, struct timeval *tv)
fatal("cvs_buf_write_stmp: cvs_buf_write_fd: `%s'", template);
}
- if (fchmod(fd, mode) < 0)
- cvs_log(LP_ERR, "permissions not set on temporary file %s",
- template);
-
if (tv != NULL) {
if (futimes(fd, tv) == -1)
fatal("cvs_buf_write_stmp: futimes failed");
diff --git a/usr.bin/cvs/buf.h b/usr.bin/cvs/buf.h
index d56eb2963e2..dbed99dfc71 100644
--- a/usr.bin/cvs/buf.h
+++ b/usr.bin/cvs/buf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: buf.h,v 1.17 2006/06/14 14:10:50 joris Exp $ */
+/* $OpenBSD: buf.h,v 1.18 2006/07/08 09:25:44 ray Exp $ */
/*
* Copyright (c) 2003 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -48,7 +48,7 @@ size_t cvs_buf_len(BUF *);
int cvs_buf_write_fd(BUF *, int);
int cvs_buf_write(BUF *, const char *, mode_t);
int cvs_buf_differ(BUF *, BUF *);
-void cvs_buf_write_stmp(BUF *, char *, mode_t, struct timeval *);
+void cvs_buf_write_stmp(BUF *, char *, struct timeval *);
ssize_t cvs_buf_copy(BUF *, size_t, void *, size_t);
const void *cvs_buf_peek(BUF *, size_t);
diff --git a/usr.bin/cvs/commit.c b/usr.bin/cvs/commit.c
index 9a66ddfb60d..c6889018060 100644
--- a/usr.bin/cvs/commit.c
+++ b/usr.bin/cvs/commit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: commit.c,v 1.80 2006/07/07 17:37:17 joris Exp $ */
+/* $OpenBSD: commit.c,v 1.81 2006/07/08 09:25:44 ray Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org>
@@ -394,11 +394,11 @@ commit_diff_file(struct cvs_file *cf)
fatal("commit_diff_file: failed to create diff buf");
(void)xasprintf(&p1, "%s/diff1.XXXXXXXXXX", cvs_tmpdir);
- cvs_buf_write_stmp(b1, p1, 0600, NULL);
+ cvs_buf_write_stmp(b1, p1, NULL);
cvs_buf_free(b1);
(void)xasprintf(&p2, "%s/diff2.XXXXXXXXXX", cvs_tmpdir);
- cvs_buf_write_stmp(b2, p2, 0600, NULL);
+ cvs_buf_write_stmp(b2, p2, NULL);
cvs_buf_free(b2);
diff_format = D_RCSDIFF;
diff --git a/usr.bin/cvs/diff.c b/usr.bin/cvs/diff.c
index af6ef52a97a..843a6f45ed3 100644
--- a/usr.bin/cvs/diff.c
+++ b/usr.bin/cvs/diff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diff.c,v 1.108 2006/07/07 17:37:17 joris Exp $ */
+/* $OpenBSD: diff.c,v 1.109 2006/07/08 09:25:44 ray Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -263,7 +263,7 @@ cvs_diff_local(struct cvs_file *cf)
if (len >= sizeof(p1))
fatal("cvs_diff_local: truncation");
- cvs_buf_write_stmp(b1, p1, 0600, tv);
+ cvs_buf_write_stmp(b1, p1, tv);
cvs_buf_free(b1);
} else {
len = strlcpy(p1, CVS_PATH_DEVNULL, sizeof(p1));
@@ -280,7 +280,7 @@ cvs_diff_local(struct cvs_file *cf)
if (len >= sizeof(p2))
fatal("cvs_diff_local: truncation");
- cvs_buf_write_stmp(b2, p2, 0600, tv2);
+ cvs_buf_write_stmp(b2, p2, tv2);
cvs_buf_free(b2);
} else {
len = strlcpy(p2, CVS_PATH_DEVNULL, sizeof(p2));
diff --git a/usr.bin/cvs/diff3.c b/usr.bin/cvs/diff3.c
index 8a16d4cffc3..d02d6f649ee 100644
--- a/usr.bin/cvs/diff3.c
+++ b/usr.bin/cvs/diff3.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diff3.c,v 1.25 2006/06/14 14:10:50 joris Exp $ */
+/* $OpenBSD: diff3.c,v 1.26 2006/07/08 09:25:44 ray Exp $ */
/*
* Copyright (C) Caldera International Inc. 2001-2002.
@@ -72,7 +72,7 @@ static const char copyright[] =
#ifndef lint
static const char rcsid[] =
- "$OpenBSD: diff3.c,v 1.25 2006/06/14 14:10:50 joris Exp $";
+ "$OpenBSD: diff3.c,v 1.26 2006/07/08 09:25:44 ray Exp $";
#endif /* not lint */
#include "includes.h"
@@ -188,13 +188,13 @@ cvs_diff3(RCSFILE *rf, char *workfile, int workfd, RCSNUM *rev1,
diffb = cvs_buf_alloc((size_t)128, BUF_AUTOEXT);
strlcpy(path1, "/tmp/diff1.XXXXXXXXXX", sizeof(path1));
- cvs_buf_write_stmp(b1, path1, 0600, NULL);
+ cvs_buf_write_stmp(b1, path1, NULL);
strlcpy(path2, "/tmp/diff2.XXXXXXXXXX", sizeof(path2));
- cvs_buf_write_stmp(b2, path2, 0600, NULL);
+ cvs_buf_write_stmp(b2, path2, NULL);
strlcpy(path3, "/tmp/diff3.XXXXXXXXXX", sizeof(path3));
- cvs_buf_write_stmp(b3, path3, 0600, NULL);
+ cvs_buf_write_stmp(b3, path3, NULL);
cvs_buf_free(b2);
b2 = NULL;
@@ -203,13 +203,13 @@ cvs_diff3(RCSFILE *rf, char *workfile, int workfd, RCSNUM *rev1,
cvs_diffreg(path2, path3, d2);
strlcpy(dp13, "/tmp/d13.XXXXXXXXXX", sizeof(dp13));
- cvs_buf_write_stmp(d1, dp13, 0600, NULL);
+ cvs_buf_write_stmp(d1, dp13, NULL);
cvs_buf_free(d1);
d1 = NULL;
strlcpy(dp23, "/tmp/d23.XXXXXXXXXX", sizeof(dp23));
- cvs_buf_write_stmp(d2, dp23, 0600, NULL);
+ cvs_buf_write_stmp(d2, dp23, NULL);
cvs_buf_free(d2);
d2 = NULL;
diff --git a/usr.bin/cvs/import.c b/usr.bin/cvs/import.c
index 5448825c521..76d1ee4b5a6 100644
--- a/usr.bin/cvs/import.c
+++ b/usr.bin/cvs/import.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: import.c,v 1.53 2006/06/19 05:05:17 joris Exp $ */
+/* $OpenBSD: import.c,v 1.54 2006/07/08 09:25:44 ray Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -344,11 +344,11 @@ import_get_rcsdiff(struct cvs_file *cf, RCSNUM *rev)
if (cvs_noexec != 1) {
(void)xasprintf(&p1, "%s/diff1.XXXXXXXXXX", cvs_tmpdir);
- cvs_buf_write_stmp(b1, p1, 0600, NULL);
+ cvs_buf_write_stmp(b1, p1, NULL);
cvs_buf_free(b1);
(void)xasprintf(&p2, "%s/diff2.XXXXXXXXXX", cvs_tmpdir);
- cvs_buf_write_stmp(b2, p2, 0600, NULL);
+ cvs_buf_write_stmp(b2, p2, NULL);
cvs_buf_free(b2);
diff_format = D_RCSDIFF;
diff --git a/usr.bin/cvs/rcs.c b/usr.bin/cvs/rcs.c
index dbe44078d78..1b772246b8c 100644
--- a/usr.bin/cvs/rcs.c
+++ b/usr.bin/cvs/rcs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcs.c,v 1.184 2006/06/09 14:57:13 xsa Exp $ */
+/* $OpenBSD: rcs.c,v 1.185 2006/07/08 09:25:44 ray Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -1409,11 +1409,11 @@ rcs_rev_remove(RCSFILE *rf, RCSNUM *rev)
/* calculate new diff */
(void)xasprintf(&path_tmp1, "%s/diff1.XXXXXXXXXX", cvs_tmpdir);
- cvs_buf_write_stmp(nextbuf, path_tmp1, 0600, NULL);
+ cvs_buf_write_stmp(nextbuf, path_tmp1, NULL);
cvs_buf_free(nextbuf);
(void)xasprintf(&path_tmp2, "%s/diff2.XXXXXXXXXX", cvs_tmpdir);
- cvs_buf_write_stmp(prevbuf, path_tmp2, 0600, NULL);
+ cvs_buf_write_stmp(prevbuf, path_tmp2, NULL);
cvs_buf_free(prevbuf);
diff_format = D_RCSDIFF;
diff --git a/usr.bin/rcs/buf.c b/usr.bin/rcs/buf.c
index d2bf8029a6f..e4bb81040fd 100644
--- a/usr.bin/rcs/buf.c
+++ b/usr.bin/rcs/buf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: buf.c,v 1.5 2006/06/03 03:05:10 niallo Exp $ */
+/* $OpenBSD: buf.c,v 1.6 2006/07/08 09:25:44 ray Exp $ */
/*
* Copyright (c) 2003 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -379,7 +379,7 @@ rcs_buf_write(BUF *b, const char *path, mode_t mode)
* <template>, as per mkstemp
*/
void
-rcs_buf_write_stmp(BUF *b, char *template, mode_t mode)
+rcs_buf_write_stmp(BUF *b, char *template)
{
int fd;
@@ -393,10 +393,6 @@ rcs_buf_write_stmp(BUF *b, char *template, mode_t mode)
errx(1, "rcs_buf_write_stmp: rcs_buf_write_fd: `%s'", template);
}
- if (fchmod(fd, mode) < 0)
- warn("permissions not set on temporary file %s",
- template);
-
(void)close(fd);
}
diff --git a/usr.bin/rcs/buf.h b/usr.bin/rcs/buf.h
index f4a7a6e8055..197118441fa 100644
--- a/usr.bin/rcs/buf.h
+++ b/usr.bin/rcs/buf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: buf.h,v 1.3 2006/06/03 03:05:10 niallo Exp $ */
+/* $OpenBSD: buf.h,v 1.4 2006/07/08 09:25:44 ray Exp $ */
/*
* Copyright (c) 2003 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -57,6 +57,6 @@ void rcs_buf_putc(BUF *, int);
size_t rcs_buf_len(BUF *);
int rcs_buf_write_fd(BUF *, int);
int rcs_buf_write(BUF *, const char *, mode_t);
-void rcs_buf_write_stmp(BUF *, char *, mode_t);
+void rcs_buf_write_stmp(BUF *, char *);
void *rcs_buf_get(BUF *b);
#endif /* BUF_H */
diff --git a/usr.bin/rcs/ci.c b/usr.bin/rcs/ci.c
index fa2ac449734..f6301f7f632 100644
--- a/usr.bin/rcs/ci.c
+++ b/usr.bin/rcs/ci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ci.c,v 1.180 2006/06/03 03:05:10 niallo Exp $ */
+/* $OpenBSD: ci.c,v 1.181 2006/07/08 09:25:44 ray Exp $ */
/*
* Copyright (c) 2005, 2006 Niall O'Higgins <niallo@openbsd.org>
* All rights reserved.
@@ -342,13 +342,13 @@ checkin_diff_file(struct checkin_params *pb)
}
(void)xasprintf(&path1, "%s/diff1.XXXXXXXXXX", rcs_tmpdir);
- rcs_buf_write_stmp(b1, path1, 0600);
+ rcs_buf_write_stmp(b1, path1);
rcs_buf_free(b1);
b1 = NULL;
(void)xasprintf(&path2, "%s/diff2.XXXXXXXXXX", rcs_tmpdir);
- rcs_buf_write_stmp(b2, path2, 0600);
+ rcs_buf_write_stmp(b2, path2);
rcs_buf_free(b2);
b2 = NULL;
diff --git a/usr.bin/rcs/diff3.c b/usr.bin/rcs/diff3.c
index 03a5ddb1c45..cb12594a0c9 100644
--- a/usr.bin/rcs/diff3.c
+++ b/usr.bin/rcs/diff3.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diff3.c,v 1.10 2006/06/03 03:05:10 niallo Exp $ */
+/* $OpenBSD: diff3.c,v 1.11 2006/07/08 09:25:44 ray Exp $ */
/*
* Copyright (C) Caldera International Inc. 2001-2002.
@@ -72,7 +72,7 @@ static const char copyright[] =
#ifndef lint
static const char rcsid[] =
- "$OpenBSD: diff3.c,v 1.10 2006/06/03 03:05:10 niallo Exp $";
+ "$OpenBSD: diff3.c,v 1.11 2006/07/08 09:25:44 ray Exp $";
#endif /* not lint */
#include "includes.h"
@@ -181,9 +181,9 @@ merge_diff3(char **av, int flags)
(void)xasprintf(&path2, "%s/diff2.XXXXXXXXXX", rcs_tmpdir);
(void)xasprintf(&path3, "%s/diff3.XXXXXXXXXX", rcs_tmpdir);
- rcs_buf_write_stmp(b1, path1, 0600);
- rcs_buf_write_stmp(b2, path2, 0600);
- rcs_buf_write_stmp(b3, path3, 0600);
+ rcs_buf_write_stmp(b1, path1);
+ rcs_buf_write_stmp(b2, path2);
+ rcs_buf_write_stmp(b3, path3);
rcs_buf_free(b2);
b2 = NULL;
@@ -196,13 +196,13 @@ merge_diff3(char **av, int flags)
}
(void)xasprintf(&dp13, "%s/d13.XXXXXXXXXX", rcs_tmpdir);
- rcs_buf_write_stmp(d1, dp13, 0600);
+ rcs_buf_write_stmp(d1, dp13);
rcs_buf_free(d1);
d1 = NULL;
(void)xasprintf(&dp23, "%s/d23.XXXXXXXXXX", rcs_tmpdir);
- rcs_buf_write_stmp(d2, dp23, 0600);
+ rcs_buf_write_stmp(d2, dp23);
rcs_buf_free(d2);
d2 = NULL;
@@ -296,9 +296,9 @@ rcs_diff3(RCSFILE *rf, char *workfile, RCSNUM *rev1, RCSNUM *rev2, int verbose)
(void)xasprintf(&path2, "%s/diff2.XXXXXXXXXX", rcs_tmpdir);
(void)xasprintf(&path3, "%s/diff3.XXXXXXXXXX", rcs_tmpdir);
- rcs_buf_write_stmp(b1, path1, 0600);
- rcs_buf_write_stmp(b2, path2, 0600);
- rcs_buf_write_stmp(b3, path3, 0600);
+ rcs_buf_write_stmp(b1, path1);
+ rcs_buf_write_stmp(b2, path2);
+ rcs_buf_write_stmp(b3, path3);
rcs_buf_free(b2);
b2 = NULL;
@@ -311,13 +311,13 @@ rcs_diff3(RCSFILE *rf, char *workfile, RCSNUM *rev1, RCSNUM *rev2, int verbose)
}
(void)xasprintf(&dp13, "%s/d13.XXXXXXXXXX", rcs_tmpdir);
- rcs_buf_write_stmp(d1, dp13, 0600);
+ rcs_buf_write_stmp(d1, dp13);
rcs_buf_free(d1);
d1 = NULL;
(void)xasprintf(&dp23, "%s/d23.XXXXXXXXXX", rcs_tmpdir);
- rcs_buf_write_stmp(d2, dp23, 0600);
+ rcs_buf_write_stmp(d2, dp23);
rcs_buf_free(d2);
d2 = NULL;
diff --git a/usr.bin/rcs/rcs.c b/usr.bin/rcs/rcs.c
index b7c79b8c8ed..7efd5a757bf 100644
--- a/usr.bin/rcs/rcs.c
+++ b/usr.bin/rcs/rcs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcs.c,v 1.21 2006/07/08 07:48:58 niallo Exp $ */
+/* $OpenBSD: rcs.c,v 1.22 2006/07/08 09:25:44 ray Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -1397,11 +1397,11 @@ rcs_rev_remove(RCSFILE *rf, RCSNUM *rev)
/* calculate new diff */
(void)xasprintf(&path_tmp1, "%s/diff1.XXXXXXXXXX", rcs_tmpdir);
- rcs_buf_write_stmp(nextbuf, path_tmp1, 0600);
+ rcs_buf_write_stmp(nextbuf, path_tmp1);
rcs_buf_free(nextbuf);
(void)xasprintf(&path_tmp2, "%s/diff2.XXXXXXXXXX", rcs_tmpdir);
- rcs_buf_write_stmp(prevbuf, path_tmp2, 0600);
+ rcs_buf_write_stmp(prevbuf, path_tmp2);
rcs_buf_free(prevbuf);
diff_format = D_RCSDIFF;
diff --git a/usr.bin/rcs/rcsdiff.c b/usr.bin/rcs/rcsdiff.c
index 2140c994c23..d99f1445ed2 100644
--- a/usr.bin/rcs/rcsdiff.c
+++ b/usr.bin/rcs/rcsdiff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcsdiff.c,v 1.66 2006/06/04 20:32:56 niallo Exp $ */
+/* $OpenBSD: rcsdiff.c,v 1.67 2006/07/08 09:25:44 ray Exp $ */
/*
* Copyright (c) 2005 Joris Vink <joris@openbsd.org>
* All rights reserved.
@@ -234,7 +234,7 @@ rcsdiff_file(RCSFILE *file, RCSNUM *rev, const char *filename)
tv2[1].tv_sec = t;
(void)xasprintf(&path1, "%s/diff1.XXXXXXXXXX", rcs_tmpdir);
- rcs_buf_write_stmp(b1, path1, 0600);
+ rcs_buf_write_stmp(b1, path1);
rcs_buf_free(b1);
b1 = NULL;
@@ -243,7 +243,7 @@ rcsdiff_file(RCSFILE *file, RCSNUM *rev, const char *filename)
warn("utimes");
(void)xasprintf(&path2, "%s/diff2.XXXXXXXXXX", rcs_tmpdir);
- rcs_buf_write_stmp(b2, path2, 0600);
+ rcs_buf_write_stmp(b2, path2);
rcs_buf_free(b2);
b2 = NULL;
@@ -316,7 +316,7 @@ rcsdiff_rev(RCSFILE *file, RCSNUM *rev1, RCSNUM *rev2)
fprintf(stderr, "%s -r%s -r%s\n", diffargs, rbuf1, rbuf2);
(void)xasprintf(&path1, "%s/diff1.XXXXXXXXXX", rcs_tmpdir);
- rcs_buf_write_stmp(b1, path1, 0600);
+ rcs_buf_write_stmp(b1, path1);
rcs_buf_free(b1);
b1 = NULL;
@@ -325,7 +325,7 @@ rcsdiff_rev(RCSFILE *file, RCSNUM *rev1, RCSNUM *rev2)
warn("utimes");
(void)xasprintf(&path2, "%s/diff2.XXXXXXXXXX", rcs_tmpdir);
- rcs_buf_write_stmp(b2, path2, 0600);
+ rcs_buf_write_stmp(b2, path2);
rcs_buf_free(b2);
b2 = NULL;