diff options
author | Xavier Santolaria <xsa@cvs.openbsd.org> | 2005-05-24 07:38:47 +0000 |
---|---|---|
committer | Xavier Santolaria <xsa@cvs.openbsd.org> | 2005-05-24 07:38:47 +0000 |
commit | dabfcfb5477f700a66bdbc7cf03fd2e0fceaeded (patch) | |
tree | 07ed62401a8a6b66dcf779f884d6b2794199eb0b /usr.bin | |
parent | defc1d429d912cb82dab74a99b9abb8721c399e0 (diff) |
cvs_noexec checks; ok joris@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/cvs/buf.c | 15 | ||||
-rw-r--r-- | usr.bin/cvs/tag.c | 10 |
2 files changed, 18 insertions, 7 deletions
diff --git a/usr.bin/cvs/buf.c b/usr.bin/cvs/buf.c index a1c2f2a0731..324d5940c2c 100644 --- a/usr.bin/cvs/buf.c +++ b/usr.bin/cvs/buf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: buf.c,v 1.8 2004/12/08 22:22:38 jfb Exp $ */ +/* $OpenBSD: buf.c,v 1.9 2005/05/24 07:38:46 xsa Exp $ */ /* * Copyright (c) 2003 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -37,6 +37,7 @@ #include <errno.h> #include "buf.h" +#include "cvs.h" #include "log.h" @@ -412,6 +413,8 @@ cvs_buf_write(BUF *b, const char *path, mode_t mode) { int ret, fd; + ret = 0; + fd = open(path, O_WRONLY|O_CREAT|O_TRUNC, mode); if (fd == -1) { cvs_log(LP_ERRNO, "failed to open file `%s': %s", @@ -419,7 +422,9 @@ cvs_buf_write(BUF *b, const char *path, mode_t mode) return (-1); } - ret = cvs_buf_write_fd(b, fd); + if (!cvs_noexec) + ret = cvs_buf_write_fd(b, fd); + if (ret == -1) { cvs_log(LP_ERRNO, "failed to write to file `%s': %s", path, strerror(errno)); @@ -443,6 +448,8 @@ cvs_buf_write_stmp(BUF *b, char *template, mode_t mode) { int ret, fd; + ret = 0; + fd = mkstemp(template); if (fd == -1) { cvs_log(LP_ERRNO, "failed to mkstemp file `%s': %s", @@ -450,7 +457,9 @@ cvs_buf_write_stmp(BUF *b, char *template, mode_t mode) return (-1); } - ret = cvs_buf_write_fd(b, fd); + if (!cvs_noexec) + ret = cvs_buf_write_fd(b, fd); + if (ret == -1) { cvs_log(LP_ERRNO, "failed to write to temp file `%s': %s", template, strerror(errno)); diff --git a/usr.bin/cvs/tag.c b/usr.bin/cvs/tag.c index c0b0502d3b3..0d6f90cbab1 100644 --- a/usr.bin/cvs/tag.c +++ b/usr.bin/cvs/tag.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tag.c,v 1.17 2005/05/24 04:12:25 jfb Exp $ */ +/* $OpenBSD: tag.c,v 1.18 2005/05/24 07:38:46 xsa Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * Copyright (c) 2004 Joris Vink <joris@openbsd.org> @@ -275,9 +275,11 @@ cvs_tag_local(CVSFILE *cf, void *arg) return (CVS_EX_DATA); } - if (rcs_sym_add(rf, tag_name, tag_rev) < 0) { - cvs_log(LP_ERR, "failed to tag %s: %s", rcspath, - rcs_errstr(rcs_errno)); + if (!cvs_noexec) { + if (rcs_sym_add(rf, tag_name, tag_rev) < 0) { + cvs_log(LP_ERR, "failed to tag %s: %s", rcspath, + rcs_errstr(rcs_errno)); + } } cvs_printf("T %s\n", fpath); |