Hello, tech@
Do not leak file descriptor `fd' on error path.
Index: printjob.c
===================================================================
RCS file: /cvs/src/usr.sbin/lpr/lpd/printjob.c,v
retrieving revision 1.45
diff -u -p -r1.45 printjob.c
--- printjob.c 27 Oct 2009 23:59:52 -0000 1.45
+++ printjob.c 21 Mar 2010 21:18:34 -0000
@@ -1627,8 +1627,10 @@ pstatus(const char *msg, ...)
ftruncate(fd, 0);
len = vsnprintf(buf, sizeof(buf), msg, ap);
va_end(ap);
- if (len == -1)
+ if (len == -1) {
+ (void)close(fd);
return;
+ }
if (len >= sizeof(buf))
len = sizeof(buf) - 1;
buf[len++] = '\n'; /* replace NUL with newline */