diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1998-09-27 21:16:43 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1998-09-27 21:16:43 +0000 |
commit | cc48dfb5856078c9e49852ad0f45f47454370a06 (patch) | |
tree | 97007b4f34a1f8acaec7ee79b7fce613a6d43c24 | |
parent | 13939eae6191771bdcfc465b883c4738d9310d25 (diff) |
Use new username option to lockspool for 'mail -u'.
-rw-r--r-- | usr.bin/mail/glob.h | 3 | ||||
-rw-r--r-- | usr.bin/mail/main.c | 5 | ||||
-rw-r--r-- | usr.bin/mail/popen.c | 18 |
3 files changed, 18 insertions, 8 deletions
diff --git a/usr.bin/mail/glob.h b/usr.bin/mail/glob.h index f5a3c3148c5..4a43011bc1a 100644 --- a/usr.bin/mail/glob.h +++ b/usr.bin/mail/glob.h @@ -1,4 +1,4 @@ -/* $OpenBSD: glob.h,v 1.3 1997/07/18 18:12:56 millert Exp $ */ +/* $OpenBSD: glob.h,v 1.4 1998/09/27 21:16:42 millert Exp $ */ /* $NetBSD: glob.h,v 1.4 1996/06/08 19:48:25 christos Exp $ */ /* @@ -83,6 +83,7 @@ int screenwidth; /* Screen width, or best guess */ int screenheight; /* Screen height, or best guess, for "header" command */ int realscreenheight; /* the real screen height */ +int uflag; /* Are we in -u mode? */ #include <setjmp.h> diff --git a/usr.bin/mail/main.c b/usr.bin/mail/main.c index aa30ae750e8..d413952827e 100644 --- a/usr.bin/mail/main.c +++ b/usr.bin/mail/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.10 1997/11/14 00:23:52 millert Exp $ */ +/* $OpenBSD: main.c,v 1.11 1998/09/27 21:16:42 millert Exp $ */ /* $NetBSD: main.c,v 1.7 1997/05/13 06:15:57 mikel Exp $ */ /* @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)main.c 8.2 (Berkeley) 4/20/95"; #else -static char rcsid[] = "$OpenBSD: main.c,v 1.10 1997/11/14 00:23:52 millert Exp $"; +static char rcsid[] = "$OpenBSD: main.c,v 1.11 1998/09/27 21:16:42 millert Exp $"; #endif #endif /* not lint */ @@ -116,6 +116,7 @@ main(argc, argv) */ unsetenv("MAIL"); myname = optarg; + uflag = 1; break; case 'i': /* diff --git a/usr.bin/mail/popen.c b/usr.bin/mail/popen.c index 967167904ae..82664f8cc0c 100644 --- a/usr.bin/mail/popen.c +++ b/usr.bin/mail/popen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: popen.c,v 1.22 1998/09/10 16:18:37 millert Exp $ */ +/* $OpenBSD: popen.c,v 1.23 1998/09/27 21:16:42 millert Exp $ */ /* $NetBSD: popen.c,v 1.6 1997/05/13 06:48:42 mikel Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)popen.c 8.1 (Berkeley) 6/6/93"; #else -static char rcsid[] = "$OpenBSD: popen.c,v 1.22 1998/09/10 16:18:37 millert Exp $"; +static char rcsid[] = "$OpenBSD: popen.c,v 1.23 1998/09/27 21:16:42 millert Exp $"; #endif #endif /* not lint */ @@ -451,13 +451,21 @@ handle_spool_locks(action) (void)Pclose(lockfp); lockfp = NULL; } else if (action == 1) { + char *cmd = _PATH_LOCKSPOOL; + + /* XXX - lockspool requires root for user arg, we do not */ + if (uflag && asprintf(&cmd, "%s %s", _PATH_LOCKSPOOL, + myname) == -1) + errx(1, "Out of memory"); + /* Create the lock */ - if ((lockfp = Popen(_PATH_LOCKSPOOL, "r")) == NULL || - getc(lockfp) != '1') { + lockfp = Popen(cmd, "r"); + if (uflag) + free(cmd); + if (lockfp == NULL || getc(lockfp) != '1') { lockfp = NULL; return(0); } - lock_pid = fp_head->pid; /* new entries added at head */ } else { (void)fprintf(stderr, "handle_spool_locks: unknown action %d\n", |