version 1.31, 2006/01/16 21:02:36 |
version 1.32, 2006/01/29 17:50:08 |
|
|
cvs_buf_write(BUF *b, const char *path, mode_t mode) |
cvs_buf_write(BUF *b, const char *path, mode_t mode) |
{ |
{ |
int fd; |
int fd; |
|
open: |
if ((fd = open(path, O_WRONLY|O_CREAT|O_TRUNC, mode)) == -1) |
if ((fd = open(path, O_WRONLY|O_CREAT|O_TRUNC, mode)) == -1) { |
fatal("open: `%s': %s", path, strerror(errno)); |
if ((errno == EACCES) && (unlink(path) != -1)) |
|
goto open; |
|
else |
|
fatal("open: `%s': %s", path, strerror(errno)); |
|
} |
|
|
if (cvs_buf_write_fd(b, fd) == -1) { |
if (cvs_buf_write_fd(b, fd) == -1) { |
(void)unlink(path); |
(void)unlink(path); |