summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/lpr/lpd/printjob.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/usr.sbin/lpr/lpd/printjob.c b/usr.sbin/lpr/lpd/printjob.c
index 29fdcc73fe2..dff077b5dc6 100644
--- a/usr.sbin/lpr/lpd/printjob.c
+++ b/usr.sbin/lpr/lpd/printjob.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: printjob.c,v 1.7 1996/09/21 07:55:35 deraadt Exp $ */
+/* $OpenBSD: printjob.c,v 1.8 1996/09/30 21:24:34 deraadt Exp $ */
/* $NetBSD: printjob.c,v 1.9.4.3 1996/07/12 22:31:39 jtc Exp $ */
/*
@@ -516,7 +516,7 @@ print(format, file)
int fi, fo;
FILE *fp;
char *av[15], buf[BUFSIZ];
- int pid, p[2], stopped = 0;
+ int pid, p[2], stopped = 0, nofile;
union wait status;
struct stat stb;
@@ -562,7 +562,7 @@ print(format, file)
dup2(fi, 0); /* file is stdin */
dup2(p[1], 1); /* pipe is stdout */
closelog();
- for (n = 3; n < NOFILE; n++)
+ for (n = 3, nofile = getdtablesize(); n < nofile; n++)
(void) close(n);
execl(_PATH_PR, "pr", width, length,
"-h", *title ? title : " ", 0);
@@ -684,7 +684,7 @@ start:
if (n >= 0)
dup2(n, 2);
closelog();
- for (n = 3; n < NOFILE; n++)
+ for (n = 3, nofile = getdtablesize(); n < nofile; n++)
(void) close(n);
execv(prog, av);
syslog(LOG_ERR, "cannot execv %s", prog);
@@ -1032,7 +1032,7 @@ sendmail(user, bombed)
char *user;
int bombed;
{
- register int i;
+ register int i, nofile;
int p[2], s;
register char *cp;
char buf[100];
@@ -1043,7 +1043,7 @@ sendmail(user, bombed)
if ((s = dofork(DORETURN)) == 0) { /* child */
dup2(p[0], 0);
closelog();
- for (i = 3; i < NOFILE; i++)
+ for (i = 3, nofile = getdtablesize(); i < nofile; i++)
(void) close(i);
if ((cp = rindex(_PATH_SENDMAIL, '/')) != NULL)
cp++;
@@ -1248,7 +1248,7 @@ init()
static void
openpr()
{
- register int i;
+ register int i, nofile;
char *cp;
if (!remote && *LP) {
@@ -1276,7 +1276,7 @@ openpr()
dup2(p[0], 0); /* pipe is std in */
dup2(pfd, 1); /* printer is std out */
closelog();
- for (i = 3; i < NOFILE; i++)
+ for (i = 3, nofile = getdtablesize(); i < nofile; i++)
(void) close(i);
if ((cp = rindex(OF, '/')) == NULL)
cp = OF;