[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
cvs gets an error if home dir doesn't exist
From: |
Jonathan Larmour |
Subject: |
cvs gets an error if home dir doesn't exist |
Date: |
Tue, 19 Mar 2002 16:36:58 +0000 |
We (sources.redhat.com) set up an "anoncvs" user with a dummy home
directory that doesn't exist. Unfortunately this conflicted with
history_write() in history.c:
/* Try harder to find a "homedir" */
struct saved_cwd cwd;
char *homedir;
if (save_cwd (&cwd))
error_exit ();
if ( CVS_CHDIR (pwdir) < 0)
error (1, errno, "can't chdir(%s)", pwdir);
This is only done to make the history file look a bit nicer by substituting
~ for the home directory, so it should not produce a fatal error. I suggest
the attached patch.
2002-03-19 Jonathan Larmour <jlarmour@redhat.com>
* history.c (history_write): Don't generate fatal errors just for
doing homedir to ~ substitution.
Jifl
--
Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062
Maybe this world is another planet's Hell -Aldous Huxley || Opinions==mine
*** /usr/local/src/cvs-1.11.1p1/src/history.c Thu Apr 19 12:45:32 2001
--- history.c Tue Mar 19 08:33:43 2002
*************** history_write (type, update_dir, revs, n
*** 770,792 ****
if (save_cwd (&cwd))
error_exit ();
! if ( CVS_CHDIR (pwdir) < 0)
! error (1, errno, "can't chdir(%s)", pwdir);
! homedir = xgetwd ();
! if (homedir == NULL)
! error (1, errno, "can't getwd in %s", pwdir);
!
! if (restore_cwd (&cwd, NULL))
! error_exit ();
! free_cwd (&cwd);
!
! i = strlen (homedir);
! if (!strncmp (CurDir, homedir, i))
{
! PrCurDir += i; /* Point to '/' separator */
! tilde = "~";
}
! free (homedir);
}
}
}
--- 770,793 ----
if (save_cwd (&cwd))
error_exit ();
! if ( CVS_CHDIR (pwdir) >= 0)
{
! homedir = xgetwd ();
! if (homedir != NULL)
! {
! if (restore_cwd (&cwd, NULL))
! error_exit ();
!
! i = strlen (homedir);
! if (!strncmp (CurDir, homedir, i))
! {
! PrCurDir += i; /* Point to '/' separator */
! tilde = "~";
! }
! free (homedir);
! }
}
! free_cwd (&cwd);
}
}
}
- cvs gets an error if home dir doesn't exist,
Jonathan Larmour <=