From 57e58c3aa7a2477ce7fa56bfea9d927b4eb43ccd Mon Sep 17 00:00:00 2001 From: Peter Wemm Date: Mon, 26 Jan 1998 03:09:57 +0000 Subject: Import cvs-1.9.23 as at 19980123. There are a number of really nice things fixed in here, including the '-ko' vs. -A problem with remote cvs which caused all files with -ko to be resent each time (which is damn painful over a modem, I can tell you). It also found a heap of stray empty directories that should have been pruned with the -P flag to cvs update but were not for some reason. It also has the fully integrated rcs and diff, so no more fork/exec overheads for rcs,ci,patch,diff,etc. This means that it parses the control data in the rcs files only once rather than twice or more. If the 'cvs diff' vs. Index thing is going to be fixed for future patch compatability, this is the place to do it. --- contrib/cvs/src/filesubr.c | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) (limited to 'contrib/cvs/src/filesubr.c') diff --git a/contrib/cvs/src/filesubr.c b/contrib/cvs/src/filesubr.c index 71df566d2882b..b5121a7d216ad 100644 --- a/contrib/cvs/src/filesubr.c +++ b/contrib/cvs/src/filesubr.c @@ -287,7 +287,8 @@ mkdir_if_needed (name) { if (mkdir (name, 0777) < 0) { - if (errno != EEXIST) + if (!(errno == EEXIST + || (errno == EACCES && isdir (name)))) error (1, errno, "cannot make directory %s", name); return 1; } @@ -416,13 +417,16 @@ int unlink_file_dir (f) const char *f; { - if (trace) + if (trace #ifdef SERVER_SUPPORT - (void) fprintf (stderr, "%c-> unlink_file_dir(%s)\n", - (server_active) ? 'S' : ' ', f); -#else - (void) fprintf (stderr, "-> unlink_file_dir(%s)\n", f); + /* This is called by the server parent process in contexts where + it is not OK to send output (e.g. after we sent "ok" to the + client). */ + && !server_active #endif + ) + (void) fprintf (stderr, "-> unlink_file_dir(%s)\n", f); + if (noexec) return (0); @@ -690,7 +694,26 @@ last_component (path) /* Return the home directory. Returns a pointer to storage managed by this function or its callees (currently getenv). This function will return the same thing every time it is - called. */ + called. Returns NULL if there is no home directory. + + Note that for a pserver server, this may return root's home + directory. What typically happens is that upon being started from + inetd, before switching users, the code in cvsrc.c calls + get_homedir which remembers root's home directory in the static + variable. Then the switch happens and get_homedir might return a + directory that we don't even have read or execute permissions for + (which is bad, when various parts of CVS try to read there). One + fix would be to make the value returned by get_homedir only good + until the next call (which would free the old value). Another fix + would be to just always malloc our answer, and let the caller free + it (that is best, because some day we may need to be reentrant). + + The workaround is to put -f in inetd.conf which means that + get_homedir won't get called until after the switch in user ID. + + The whole concept of a "home directory" on the server is pretty + iffy, although I suppose some people probably are relying on it for + .cvsrc and such, in the cases where it works. */ char * get_homedir () { -- cgit v1.2.3