diff options
author | Joris Vink <joris@cvs.openbsd.org> | 2008-03-04 16:43:52 +0000 |
---|---|---|
committer | Joris Vink <joris@cvs.openbsd.org> | 2008-03-04 16:43:52 +0000 |
commit | 5609a1f867f37074b656532b8253edbdac6511f6 (patch) | |
tree | b6f983ddc1a515af90e92e07f6ef7bd7833fa0a2 /usr.bin | |
parent | 96562609f781e649005e7a677c6a28d9241e8502 (diff) |
fix segfault when trying to lock and unlock rcs files that
contain no revisions.
reported by Jean Raby.
ok deraadt@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/rcs/rcsprog.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/usr.bin/rcs/rcsprog.c b/usr.bin/rcs/rcsprog.c index ac3356c9dd5..4354eead314 100644 --- a/usr.bin/rcs/rcsprog.c +++ b/usr.bin/rcs/rcsprog.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcsprog.c,v 1.140 2008/02/24 15:13:18 xsa Exp $ */ +/* $OpenBSD: rcsprog.c,v 1.141 2008/03/04 16:43:51 joris Exp $ */ /* * Copyright (c) 2005 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -436,6 +436,12 @@ rcs_main(int argc, char **argv) const char *username; char rev_str[RCS_REV_BUFSZ]; + if (file->rf_head == NULL) { + warnx("%s contains no revisions", fpath); + rcs_close(file); + continue; + } + if ((username = getlogin()) == NULL) err(1, "getlogin"); if (lrev == NULL) { @@ -462,6 +468,12 @@ rcs_main(int argc, char **argv) const char *username; char rev_str[RCS_REV_BUFSZ]; + if (file->rf_head == NULL) { + warnx("%s contains no revisions", fpath); + rcs_close(file); + continue; + } + if ((username = getlogin()) == NULL) err(1, "getlogin"); if (urev == NULL) { |