printjob.c (138939) | printjob.c (139035) |
---|---|
1/* 2 * Copyright (c) 1983, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 31 unchanged lines hidden (view full) --- 40 41#if 0 42#ifndef lint 43static char sccsid[] = "@(#)printjob.c 8.7 (Berkeley) 5/10/95"; 44#endif /* not lint */ 45#endif 46 47#include "lp.cdefs.h" /* A cross-platform version of <sys/cdefs.h> */ | 1/* 2 * Copyright (c) 1983, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 31 unchanged lines hidden (view full) --- 40 41#if 0 42#ifndef lint 43static char sccsid[] = "@(#)printjob.c 8.7 (Berkeley) 5/10/95"; 44#endif /* not lint */ 45#endif 46 47#include "lp.cdefs.h" /* A cross-platform version of <sys/cdefs.h> */ |
48__FBSDID("$FreeBSD: head/usr.sbin/lpr/lpd/printjob.c 138939 2004-12-17 01:54:50Z gad $"); | 48__FBSDID("$FreeBSD: head/usr.sbin/lpr/lpd/printjob.c 139035 2004-12-19 05:14:29Z gad $"); |
49 50/* 51 * printjob -- print jobs in the queue. 52 * 53 * NOTE: the lock file is used to pass information to lpq and lprm. 54 * it does not need to be removed because file locks are dynamic. 55 */ 56 --- 140 unchanged lines hidden (view full) --- 197 */ 198 if (chdir(pp->spool_dir) < 0) { 199 syslog(LOG_ERR, "%s: chdir(%s): %m", pp->printer, 200 pp->spool_dir); 201 exit(1); 202 } 203 if (stat(pp->lock_file, &stb) == 0 && (stb.st_mode & LFM_PRINT_DIS)) 204 exit(0); /* printing disabled */ | 49 50/* 51 * printjob -- print jobs in the queue. 52 * 53 * NOTE: the lock file is used to pass information to lpq and lprm. 54 * it does not need to be removed because file locks are dynamic. 55 */ 56 --- 140 unchanged lines hidden (view full) --- 197 */ 198 if (chdir(pp->spool_dir) < 0) { 199 syslog(LOG_ERR, "%s: chdir(%s): %m", pp->printer, 200 pp->spool_dir); 201 exit(1); 202 } 203 if (stat(pp->lock_file, &stb) == 0 && (stb.st_mode & LFM_PRINT_DIS)) 204 exit(0); /* printing disabled */ |
205 umask(S_IWOTH); |
|
205 lfd = open(pp->lock_file, O_WRONLY|O_CREAT|O_EXLOCK|O_NONBLOCK, 206 LOCK_FILE_MODE); 207 if (lfd < 0) { 208 if (errno == EWOULDBLOCK) /* active daemon present */ 209 exit(0); 210 syslog(LOG_ERR, "%s: open(%s): %m", pp->printer, 211 pp->lock_file); 212 exit(1); --- 1756 unchanged lines hidden (view full) --- 1969static void 1970pstatus(const struct printer *pp, const char *msg, ...) 1971{ 1972 int fd; 1973 char *buf; 1974 va_list ap; 1975 va_start(ap, msg); 1976 | 206 lfd = open(pp->lock_file, O_WRONLY|O_CREAT|O_EXLOCK|O_NONBLOCK, 207 LOCK_FILE_MODE); 208 if (lfd < 0) { 209 if (errno == EWOULDBLOCK) /* active daemon present */ 210 exit(0); 211 syslog(LOG_ERR, "%s: open(%s): %m", pp->printer, 212 pp->lock_file); 213 exit(1); --- 1756 unchanged lines hidden (view full) --- 1970static void 1971pstatus(const struct printer *pp, const char *msg, ...) 1972{ 1973 int fd; 1974 char *buf; 1975 va_list ap; 1976 va_start(ap, msg); 1977 |
1977 umask(0); | 1978 umask(S_IWOTH); |
1978 fd = open(pp->status_file, O_WRONLY|O_CREAT|O_EXLOCK, STAT_FILE_MODE); 1979 if (fd < 0) { 1980 syslog(LOG_ERR, "%s: open(%s): %m", pp->printer, 1981 pp->status_file); 1982 exit(1); 1983 } 1984 ftruncate(fd, 0); 1985 vasprintf(&buf, msg, ap); --- 12 unchanged lines hidden --- | 1979 fd = open(pp->status_file, O_WRONLY|O_CREAT|O_EXLOCK, STAT_FILE_MODE); 1980 if (fd < 0) { 1981 syslog(LOG_ERR, "%s: open(%s): %m", pp->printer, 1982 pp->status_file); 1983 exit(1); 1984 } 1985 ftruncate(fd, 0); 1986 vasprintf(&buf, msg, ap); --- 12 unchanged lines hidden --- |