diff options
Diffstat (limited to 'usr.bin/cvs/util.c')
-rw-r--r-- | usr.bin/cvs/util.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/usr.bin/cvs/util.c b/usr.bin/cvs/util.c index 799e9fd6794..e983df8dbbb 100644 --- a/usr.bin/cvs/util.c +++ b/usr.bin/cvs/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.37 2005/07/19 15:36:54 xsa Exp $ */ +/* $OpenBSD: util.c,v 1.38 2005/07/23 10:49:35 xsa Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -500,6 +500,24 @@ cvs_exec(int argc, char **argv, int fds[3]) } /* + * cvs_chdir() + * + * Change to directory. + * chdir() wrapper with an error message. + * Returns 0 on success, or -1 on failure. + */ +int +cvs_chdir(const char *path) +{ + if (chdir(path) == -1) { + cvs_log(LP_ERRNO, "cannot change to dir `%s'", path); + return (-1); + } + + return (0); +} + +/* * cvs_remove_dir() * * Remove a directory tree from disk. |