diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2007-01-26 21:59:12 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2007-01-26 21:59:12 +0000 |
commit | 19aad8f90cb7b1ecf6f7c046006a7668721cc12e (patch) | |
tree | 44566f866a07d5d02837c501363097bc9e0b4bc0 /usr.bin/cvs/rcs.c | |
parent | 1dc1e685e35f59cc0cd89a24510839b45f0150da (diff) |
more fixe size buffers on the stack. ok xsa@ joris@
Diffstat (limited to 'usr.bin/cvs/rcs.c')
-rw-r--r-- | usr.bin/cvs/rcs.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/usr.bin/cvs/rcs.c b/usr.bin/cvs/rcs.c index 28f633bd73b..183df490b07 100644 --- a/usr.bin/cvs/rcs.c +++ b/usr.bin/cvs/rcs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcs.c,v 1.205 2007/01/26 21:48:17 xsa Exp $ */ +/* $OpenBSD: rcs.c,v 1.206 2007/01/26 21:59:11 otto Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -521,7 +521,7 @@ rcs_movefile(char *from, char *to, mode_t perm, u_int to_flags) { FILE *src, *dst; size_t nread, nwritten; - char *buf; + char buf[MAXBSIZE]; int ret; ret = -1; @@ -557,7 +557,6 @@ rcs_movefile(char *from, char *to, mode_t perm, u_int to_flags) return (-1); } - buf = xmalloc(MAXBSIZE); while ((nread = fread(buf, sizeof(char), MAXBSIZE, src)) != 0) { if (ferror(src)) { cvs_log(LP_ERRNO, "failed to read `%s'", from); @@ -572,14 +571,12 @@ rcs_movefile(char *from, char *to, mode_t perm, u_int to_flags) } } + (void)unlink(from); ret = 0; +out: (void)fclose(src); (void)fclose(dst); - (void)unlink(from); - -out: - xfree(buf); return (ret); } |