=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/rcs/rcs.c,v retrieving revision 1.56 retrieving revision 1.57 diff -c -r1.56 -r1.57 *** src/usr.bin/rcs/rcs.c 2010/07/13 20:07:24 1.56 --- src/usr.bin/rcs/rcs.c 2010/07/21 09:22:19 1.57 *************** *** 1,4 **** ! /* $OpenBSD: rcs.c,v 1.56 2010/07/13 20:07:24 nicm Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. --- 1,4 ---- ! /* $OpenBSD: rcs.c,v 1.57 2010/07/21 09:22:19 ray Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. *************** *** 1344,1361 **** * 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; struct passwd *pw; struct rcs_delta *ordp, *rdp; - uid_t uid; if (rev == RCS_HEAD_REV) { if (rf->rf_flags & RCS_CREATE) { --- 1344,1359 ---- * 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; struct passwd *pw; struct rcs_delta *ordp, *rdp; if (rev == RCS_HEAD_REV) { if (rf->rf_flags & RCS_CREATE) { *************** *** 1373,1382 **** } } - uid = getuid(); - if ((pw = getpwuid(uid)) == NULL) - errx(1, "getpwuid failed"); - rdp = xcalloc(1, sizeof(*rdp)); TAILQ_INIT(&(rdp->rd_branches)); --- 1371,1376 ---- *************** *** 1392,1403 **** rcsnum_cpy(ordp->rd_num, rdp->rd_next, 0); } ! 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); --- 1386,1397 ---- rcsnum_cpy(ordp->rd_num, rdp->rd_next, 0); } ! if (!author && !(author = getlogin())) { ! if (!(pw = getpwuid(getuid()))) ! errx(1, "getpwuid failed"); ! author = pw->pw_name; ! } ! rdp->rd_author = xstrdup(author); rdp->rd_state = xstrdup(RCS_STATE_EXP); rdp->rd_log = xstrdup(msg);