diff options
author | Niall O'Higgins <niallo@cvs.openbsd.org> | 2006-04-10 19:03:11 +0000 |
---|---|---|
committer | Niall O'Higgins <niallo@cvs.openbsd.org> | 2006-04-10 19:03:11 +0000 |
commit | a3ec948694ddf8e8758f8275087e78b48874e655 (patch) | |
tree | e5a5732d69ec8484fe5599260bda4a317c5600f3 /usr.bin/cvs/buf.c | |
parent | 03e5277f3079cd4bbd1ac18aae75b3390b5c827a (diff) |
- use fchmod() instead of chmod() in cvs_buf_write_stmp(), makes
it like cvs_buf_write()
- print warning on fchmod() failure (suggested by ray)
ok joris@ ray@
Diffstat (limited to 'usr.bin/cvs/buf.c')
-rw-r--r-- | usr.bin/cvs/buf.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/usr.bin/cvs/buf.c b/usr.bin/cvs/buf.c index 4a284229d38..096feb2c670 100644 --- a/usr.bin/cvs/buf.c +++ b/usr.bin/cvs/buf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: buf.c,v 1.43 2006/04/06 16:48:34 xsa Exp $ */ +/* $OpenBSD: buf.c,v 1.44 2006/04/10 19:03:10 niallo Exp $ */ /* * Copyright (c) 2003 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -351,10 +351,11 @@ cvs_buf_write(BUF *b, const char *path, mode_t mode) (void)unlink(path); fatal("cvs_buf_write: cvs_buf_write_fd: `%s'", path); } - (void)close(fd); - if (chmod(path, mode) < 0) - fatal("cvs_buf_write: chmod failed: %s", strerror(errno)); + if (fchmod(fd, mode) < 0) + cvs_log(LP_ERRNO, "permissions not set on file %s", path); + + (void)close(fd); return (0); } @@ -378,7 +379,10 @@ cvs_buf_write_stmp(BUF *b, char *template, mode_t mode) (void)unlink(template); fatal("cvs_buf_write_stmp: cvs_buf_write_fd: `%s'", template); } - (void)fchmod(fd, mode); + if (fchmod(fd, mode) < 0) + cvs_log(LP_ERRNO, "permissions not set on temporary file %s", + template); + (void)close(fd); } |