summaryrefslogtreecommitdiff
path: root/usr.bin/cvs
diff options
context:
space:
mode:
authorXavier Santolaria <xsa@cvs.openbsd.org>2005-07-23 10:59:48 +0000
committerXavier Santolaria <xsa@cvs.openbsd.org>2005-07-23 10:59:48 +0000
commit9cb789f35012b533e6bb67128d89a9154482620c (patch)
treed6b5c4ee0eac90d2b324aa9148f58763c0f54d1b /usr.bin/cvs
parenta5c25d0140b061a6d3a831d8ce48bce43b8835fc (diff)
use cvs_chdir();
Diffstat (limited to 'usr.bin/cvs')
-rw-r--r--usr.bin/cvs/release.c12
-rw-r--r--usr.bin/cvs/req.c10
-rw-r--r--usr.bin/cvs/server.c7
-rw-r--r--usr.bin/cvs/util.c6
4 files changed, 10 insertions, 25 deletions
diff --git a/usr.bin/cvs/release.c b/usr.bin/cvs/release.c
index 9bc8ee0eb10..5a3bc2e085f 100644
--- a/usr.bin/cvs/release.c
+++ b/usr.bin/cvs/release.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: release.c,v 1.16 2005/07/22 16:27:29 joris Exp $ */
+/* $OpenBSD: release.c,v 1.17 2005/07/23 10:59:47 xsa Exp $ */
/*
* Copyright (c) 2005 Xavier Santolaria <xsa@openbsd.org>
* All rights reserved.
@@ -176,11 +176,8 @@ cvs_release_dir(CVSFILE *cf, void *arg)
cvs_log(LP_ERRNO, "cannot get current dir");
/* change dir before running the `cvs update' command */
- if (chdir(dpath) == -1) {
- cvs_log(LP_ERRNO, "cannot change to dir `%s'",
- dpath);
+ if (cvs_chdir(dpath) == -1)
return (CVS_EX_FILE);
- }
/* construct `cvs update' command */
l = snprintf(updcmd, sizeof(updcmd), "%s %s %s update",
@@ -222,11 +219,8 @@ cvs_release_dir(CVSFILE *cf, void *arg)
}
/* change back to original working dir */
- if (chdir(wdir) == -1) {
- cvs_log(LP_ERRNO, "cannot change to original "
- "working dir `%s'", wdir);
+ if (cvs_chdir(wdir) == -1)
return (CVS_EX_FILE);
- }
if (dflag == 1) {
if (!cvs_noexec && cvs_remove_dir(dpath) != 0) {
diff --git a/usr.bin/cvs/req.c b/usr.bin/cvs/req.c
index 4e8ee6eceb5..6fa2098b74e 100644
--- a/usr.bin/cvs/req.c
+++ b/usr.bin/cvs/req.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: req.c,v 1.27 2005/07/22 17:55:35 xsa Exp $ */
+/* $OpenBSD: req.c,v 1.28 2005/07/23 10:59:47 xsa Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -292,10 +292,8 @@ cvs_req_directory(int reqid, char *line)
* Lets make sure we always start at the correct
* directory.
*/
- if (chdir(cvs_server_tmpdir) == -1) {
- cvs_log(LP_ERRNO, "failed to change to top directory");
+ if (cvs_chdir(cvs_server_tmpdir) == -1)
return (-1);
- }
/*
* Set repository path.
@@ -661,10 +659,8 @@ cvs_req_command(int reqid, char *line)
/* switch to the correct directory */
if (cmdp->cmd_op != CVS_OP_VERSION) {
- if (chdir(cvs_server_tmpdir) == -1) {
- cvs_log(LP_ERRNO, "failed to change dir");
+ if (cvs_chdir(cvs_server_tmpdir) == -1)
return (-1);
- }
}
ret = cvs_startcmd(cmdp, cvs_req_nargs, cvs_req_args);
diff --git a/usr.bin/cvs/server.c b/usr.bin/cvs/server.c
index 6552c7cc686..5045d5b159b 100644
--- a/usr.bin/cvs/server.c
+++ b/usr.bin/cvs/server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server.c,v 1.18 2005/05/31 08:58:48 xsa Exp $ */
+/* $OpenBSD: server.c,v 1.19 2005/07/23 10:59:47 xsa Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -100,11 +100,8 @@ cvs_server(int argc, char **argv)
return (CVS_EX_FILE);
}
- if (chdir(cvs_server_tmpdir) == -1) {
- cvs_log(LP_ERRNO, "failed to change to temporary directory '%s'",
- cvs_server_tmpdir);
+ if (cvs_chdir(cvs_server_tmpdir) == -1)
return (CVS_EX_FILE);
- }
for (;;) {
if (fgets(reqbuf, sizeof(reqbuf), stdin) == NULL) {
diff --git a/usr.bin/cvs/util.c b/usr.bin/cvs/util.c
index e983df8dbbb..34e39313711 100644
--- a/usr.bin/cvs/util.c
+++ b/usr.bin/cvs/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.38 2005/07/23 10:49:35 xsa Exp $ */
+/* $OpenBSD: util.c,v 1.39 2005/07/23 10:59:47 xsa Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -666,10 +666,8 @@ cvs_create_dir(const char *path, int create_adm, char *root, char *repo)
/*
* All went ok, switch to the newly created directory.
*/
- if (chdir(d) == -1) {
- cvs_log(LP_ERRNO, "failed to change dir to `%s'", d);
+ if (cvs_chdir(d) == -1)
goto done;
- }
d = strtok(NULL, "/");
}