diff options
author | Moritz Jodeit <moritz@cvs.openbsd.org> | 2005-10-14 13:46:37 +0000 |
---|---|---|
committer | Moritz Jodeit <moritz@cvs.openbsd.org> | 2005-10-14 13:46:37 +0000 |
commit | 6686bf8fc7bfe6d4141326b3f6e2611f5d03c76f (patch) | |
tree | e392b0d212c3bc7190178bdab1a8ae8be2378638 /usr.bin | |
parent | 755b1ab58ddd8d7e10eef1f372514da4d9286550 (diff) |
remove temporary cvs directory in error cases too. ok joris@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/cvs/server.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/usr.bin/cvs/server.c b/usr.bin/cvs/server.c index 3d398386610..3c211309833 100644 --- a/usr.bin/cvs/server.c +++ b/usr.bin/cvs/server.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server.c,v 1.23 2005/08/14 19:49:18 xsa Exp $ */ +/* $OpenBSD: server.c,v 1.24 2005/10/14 13:46:36 moritz Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -99,15 +99,19 @@ cvs_server(int argc, char **argv) return (CVS_EX_FILE); } - if (cvs_chdir(cvs_server_tmpdir) == -1) + if (cvs_chdir(cvs_server_tmpdir) == -1) { + cvs_rmdir(cvs_server_tmpdir); return (CVS_EX_FILE); + } for (;;) { if (fgets(reqbuf, (int)sizeof(reqbuf), stdin) == NULL) { if (feof(stdin)) break; - else if (ferror(stdin)) + else if (ferror(stdin)) { + cvs_rmdir(cvs_server_tmpdir); return (CVS_EX_DATA); + } } len = strlen(reqbuf); @@ -115,6 +119,7 @@ cvs_server(int argc, char **argv) continue; else if (reqbuf[len - 1] != '\n') { cvs_log(LP_ERR, "truncated request"); + cvs_rmdir(cvs_server_tmpdir); return (CVS_EX_PROTO); } reqbuf[--len] = '\0'; |