=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/cvs/rcs.c,v retrieving revision 1.294 retrieving revision 1.295 diff -c -r1.294 -r1.295 *** src/usr.bin/cvs/rcs.c 2010/07/13 20:41:55 1.294 --- src/usr.bin/cvs/rcs.c 2010/07/21 09:22:17 1.295 *************** *** 1,4 **** ! /* $OpenBSD: rcs.c,v 1.294 2010/07/13 20:41:55 nicm Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. --- 1,4 ---- ! /* $OpenBSD: rcs.c,v 1.295 2010/07/21 09:22:17 ray Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. *************** *** 1194,1213 **** * one). The argument specifies the log message for that revision, and * specifies the revision's date (a value of -1 is * equivalent to using the current time). ! * If is NULL, set the author for this revision to the current user. ! * Otherwise, set it to . * Returns 0 on success, or -1 on failure. */ int rcs_rev_add(RCSFILE *rf, RCSNUM *rev, const char *msg, time_t date, ! const char *username) { time_t now; RCSNUM *root = NULL; struct passwd *pw; struct rcs_branch *brp, *obrp; struct rcs_delta *ordp, *rdp; - uid_t uid; if (rev == RCS_HEAD_REV) { if (rf->rf_flags & RCS_CREATE) { --- 1194,1211 ---- * one). The argument specifies the log message for that revision, and * specifies the revision's date (a value of -1 is * equivalent to using the current time). ! * If is NULL, set the author for this revision to the current user. * Returns 0 on success, or -1 on failure. */ int rcs_rev_add(RCSFILE *rf, RCSNUM *rev, const char *msg, time_t date, ! const char *author) { time_t now; RCSNUM *root = NULL; struct passwd *pw; struct rcs_branch *brp, *obrp; struct rcs_delta *ordp, *rdp; if (rev == RCS_HEAD_REV) { if (rf->rf_flags & RCS_CREATE) { *************** *** 1227,1236 **** return (-1); } - uid = getuid(); - if ((pw = getpwuid(uid)) == NULL) - fatal("getpwuid failed"); - rdp = xcalloc(1, sizeof(*rdp)); TAILQ_INIT(&(rdp->rd_branches)); --- 1225,1230 ---- *************** *** 1240,1251 **** rdp->rd_next = rcsnum_alloc(); ! if (uid == 0) ! username = getlogin(); ! if (username == NULL || *username == '\0') ! username = pw->pw_name; ! ! rdp->rd_author = xstrdup(username); rdp->rd_state = xstrdup(RCS_STATE_EXP); rdp->rd_log = xstrdup(msg); --- 1234,1245 ---- rdp->rd_next = rcsnum_alloc(); ! if (!author && !(author = getlogin())) { ! if (!(pw = getpwuid(getuid()))) ! fatal("getpwuid failed"); ! author = pw->pw_name; ! } ! rdp->rd_author = xstrdup(author); rdp->rd_state = xstrdup(RCS_STATE_EXP); rdp->rd_log = xstrdup(msg);