=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/rcs/ci.c,v retrieving revision 1.60 retrieving revision 1.61 diff -u -r1.60 -r1.61 --- src/usr.bin/rcs/ci.c 2005/11/17 00:03:04 1.60 +++ src/usr.bin/rcs/ci.c 2005/11/17 00:16:35 1.61 @@ -1,4 +1,4 @@ -/* $OpenBSD: ci.c,v 1.60 2005/11/17 00:03:04 niallo Exp $ */ +/* $OpenBSD: ci.c,v 1.61 2005/11/17 00:16:35 niallo Exp $ */ /* * Copyright (c) 2005 Niall O'Higgins * All rights reserved. @@ -72,6 +72,7 @@ static char * checkin_getlogmsg(RCSNUM *, RCSNUM *); static void checkin_init(struct checkin_params *); static void checkin_revert(struct checkin_params *pb); +static int checkin_setrevdate(struct checkin_params *pb); void checkin_usage(void) @@ -325,15 +326,10 @@ * Set the date of the revision to be the last modification * time of the working file if -d has no argument. */ - if (pb.date == DATE_MTIME) { - if (stat(pb.filename, &sb) != 0) { - cvs_log(LP_ERRNO, "failed to stat: `%s'", - pb.filename); - rcs_close(pb.file); - continue; - } - pb.date = (time_t)sb.st_mtimespec.tv_sec; - } + if (pb.date == DATE_MTIME + && (checkin_setrevdate(&pb) < 0)) + continue; + /* * Now add our new revision @@ -673,5 +669,27 @@ rcs_close(pb->file); return (-1); } + return (0); +} + +/* + * checkin_setrevdate() + * + * Set the date of the revision to be the last modification + * time of the working file if -d has no argument. + * + * On success, return 0. On error return -1. + */ +static int +checkin_setrevdate(struct checkin_params *pb) +{ + struct stat sb; + if (stat(pb->filename, &sb) != 0) { + cvs_log(LP_ERRNO, "failed to stat: `%s'", + pb->filename); + rcs_close(pb->file); + return (-1); + } + pb->date = (time_t)sb.st_mtimespec.tv_sec; return (0); }