CVS commit: src/usr.sbin/lpr/lpr

2012-06-01 Thread John Nemeth
Module Name:src
Committed By:   jnemeth
Date:   Sat Jun  2 03:32:53 UTC 2012

Modified Files:
src/usr.sbin/lpr/lpr: lpr.c

Log Message:
PR/46500 - Henning Petersen -- wrong permissions on create .seq files


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/usr.sbin/lpr/lpr/lpr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/lpr/lpr/lpr.c
diff -u src/usr.sbin/lpr/lpr/lpr.c:1.45 src/usr.sbin/lpr/lpr/lpr.c:1.46
--- src/usr.sbin/lpr/lpr/lpr.c:1.45	Tue Aug 30 19:27:37 2011
+++ src/usr.sbin/lpr/lpr/lpr.c	Sat Jun  2 03:32:53 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: lpr.c,v 1.45 2011/08/30 19:27:37 joerg Exp $	*/
+/*	$NetBSD: lpr.c,v 1.46 2012/06/02 03:32:53 jnemeth Exp $	*/
 
 /*
  * Copyright (c) 1983, 1989, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)lpr.c	8.4 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: lpr.c,v 1.45 2011/08/30 19:27:37 joerg Exp $");
+__RCSID("$NetBSD: lpr.c,v 1.46 2012/06/02 03:32:53 jnemeth Exp $");
 #endif
 #endif /* not lint */
 
@@ -698,7 +698,7 @@ mktemps(void)
 
 	(void)snprintf(buf, sizeof(buf), "%s/.seq", SD);
 	seteuid(euid);
-	if ((fd = open(buf, O_RDWR|O_CREAT, 0661)) < 0)
+	if ((fd = open(buf, O_RDWR|O_CREAT, 0664)) < 0)
 		err(1, "cannot create %s", buf);
 	if (flock(fd, LOCK_EX))
 		err(1, "cannot lock %s", buf);



CVS commit: src/usr.sbin/lpr/lpr

2011-01-20 Thread Brian Ginsbach
Module Name:src
Committed By:   ginsbach
Date:   Thu Jan 20 15:48:12 UTC 2011

Modified Files:
src/usr.sbin/lpr/lpr: lpr.c

Log Message:
- Replace fatal2() with the appropriate err(3)/errx(3) calls.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/usr.sbin/lpr/lpr/lpr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/lpr/lpr/lpr.c
diff -u src/usr.sbin/lpr/lpr/lpr.c:1.43 src/usr.sbin/lpr/lpr/lpr.c:1.44
--- src/usr.sbin/lpr/lpr/lpr.c:1.43	Thu Aug 20 21:25:59 2009
+++ src/usr.sbin/lpr/lpr/lpr.c	Thu Jan 20 15:48:11 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: lpr.c,v 1.43 2009/08/20 21:25:59 he Exp $	*/
+/*	$NetBSD: lpr.c,v 1.44 2011/01/20 15:48:11 ginsbach Exp $	*/
 
 /*
  * Copyright (c) 1983, 1989, 1993
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)lpr.c	8.4 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: lpr.c,v 1.43 2009/08/20 21:25:59 he Exp $");
+__RCSID("$NetBSD: lpr.c,v 1.44 2011/01/20 15:48:11 ginsbach Exp $");
 #endif
 #endif /* not lint */
 
@@ -106,8 +106,6 @@
 static void	 chkprinter(const char *);
 static void	 cleanup(int);
 static void	 copy(int, const char *);
-static void	 fatal2(const char *, ...)
-__attribute__((__format__(__printf__, 1, 2),__noreturn__));
 static char	*itoa(int);
 static const char	*linked(const char *);
 static char	*lmktemp(const char *, int, int);
@@ -262,9 +260,9 @@
 		printer = DEFLP;
 	chkprinter(printer);
 	if (SC && ncopies > 1)
-		fatal2("multiple copies are not allowed");
+		errx(EXIT_FAILURE, "multiple copies are not allowed");
 	if (MC > 0 && ncopies > MC)
-		fatal2("only %ld copies are allowed", MC);
+		errx(EXIT_FAILURE, "only %ld copies are allowed", MC);
 	/*
 	 * Get the identity of the person doing the lpr using the same
 	 * algorithm as lprm. 
@@ -272,7 +270,7 @@
 	userid = getuid();
 	if (userid != DU || person == 0) {
 		if ((pw = getpwuid(userid)) == NULL)
-			fatal2("Who are you?");
+			errx(EXIT_FAILURE, "Who are you?");
 		person = pw->pw_name;
 	}
 	/*
@@ -280,7 +278,8 @@
 	 */
 	if (RG != NULL && userid != DU) {
 		if ((gptr = getgrnam(RG)) == NULL)
-			fatal2("Restricted group specified incorrectly");
+			errx(EXIT_FAILURE,
+			 "Restricted group specified incorrectly");
 		if (gptr->gr_gid != getgid()) {
 			while (*gptr->gr_mem != NULL) {
 if ((strcmp(person, *gptr->gr_mem)) == 0)
@@ -288,7 +287,8 @@
 gptr->gr_mem++;
 			}
 			if (*gptr->gr_mem == NULL)
-fatal2("Not a member of the restricted group");
+errx(EXIT_FAILURE,
+ "Not a member of the restricted group");
 		}
 	}
 	/*
@@ -296,7 +296,7 @@
 	 */
 	(void)snprintf(buf, sizeof buf, "%s/%s", SD, LO);
 	if (userid && stat(buf, &stb) == 0 && (stb.st_mode & S_IXGRP))
-		fatal2("Printer queue is disabled");
+		errx(EXIT_FAILURE, "Printer queue is disabled");
 	/*
 	 * Initialize the control file.
 	 */
@@ -515,7 +515,8 @@
 	size_t len = 2;
 
 	if (strlen(p2) > BUFSIZ - 2)
-		errx(1, "Internal error:  String longer than %d", BUFSIZ);
+		errx(EXIT_FAILURE,
+		 "Internal error:  String longer than %d", BUFSIZ);
 
 	*p1++ = c;
 	while ((c = *p2++) != '\0') {
@@ -732,26 +733,11 @@
 	char *s;
 
 	if ((s = malloc(len)) == NULL)
-		fatal2("out of memory");
+		err(EXIT_FAILURE, NULL);
 	(void)snprintf(s, len, "%s/%sA%03d%s", SD, id, num, host);
 	return(s);
 }
 
-#include 
-
-static void
-fatal2(const char *msg, ...)
-{
-	va_list ap;
-
-	va_start(ap, msg);
-	printf("%s: ", getprogname());
-	vprintf(msg, ap);
-	putchar('\n');
-	va_end(ap);
-	exit(1);
-}
-
 static void
 usage(void)
 {



CVS commit: src/usr.sbin/lpr/lpr

2009-08-20 Thread Havard Eidnes
Module Name:src
Committed By:   he
Date:   Thu Aug 20 21:25:59 UTC 2009

Modified Files:
src/usr.sbin/lpr/lpr: lpr.c

Log Message:
Remove what appears to be a spurious include of a.out.h.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/usr.sbin/lpr/lpr/lpr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/lpr/lpr/lpr.c
diff -u src/usr.sbin/lpr/lpr/lpr.c:1.42 src/usr.sbin/lpr/lpr/lpr.c:1.43
--- src/usr.sbin/lpr/lpr/lpr.c:1.42	Sun Jan 18 09:57:26 2009
+++ src/usr.sbin/lpr/lpr/lpr.c	Thu Aug 20 21:25:59 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: lpr.c,v 1.42 2009/01/18 09:57:26 lukem Exp $	*/
+/*	$NetBSD: lpr.c,v 1.43 2009/08/20 21:25:59 he Exp $	*/
 
 /*
  * Copyright (c) 1983, 1989, 1993
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)lpr.c	8.4 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: lpr.c,v 1.42 2009/01/18 09:57:26 lukem Exp $");
+__RCSID("$NetBSD: lpr.c,v 1.43 2009/08/20 21:25:59 he Exp $");
 #endif
 #endif /* not lint */
 
@@ -59,7 +59,6 @@
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include