diff options
author | Michael Sweet <michael.r.sweet@gmail.com> | 2017-06-15 20:53:04 -0400 |
---|---|---|
committer | Michael Sweet <michael.r.sweet@gmail.com> | 2017-06-15 20:53:04 -0400 |
commit | 2a75f21b6a90dcb02b7333d3c17fd08a1c89a93e (patch) | |
tree | a9a054724fbfeb093ee4d2de3c4fa030f5e9106b /cups/file.c | |
parent | ac032efa3e54de42e1666bdf0f5c72a769f99b85 (diff) | |
download | cups-2a75f21b6a90dcb02b7333d3c17fd08a1c89a93e.tar.gz |
Sync up with changes from IPP sample code project.
Diffstat (limited to 'cups/file.c')
-rw-r--r-- | cups/file.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/cups/file.c b/cups/file.c index a027df405..731a7fafa 100644 --- a/cups/file.c +++ b/cups/file.c @@ -4,9 +4,9 @@ * Since stdio files max out at 256 files on many systems, we have to * write similar functions without this limit. At the same time, using * our own file functions allows us to provide transparent support of - * gzip'd print files, PPD files, etc. + * different line endings, gzip'd print files, PPD files, etc. * - * Copyright 2007-2015 by Apple Inc. + * Copyright 2007-2017 by Apple Inc. * Copyright 1997-2007 by Easy Software Products, all rights reserved. * * These coded instructions, statements, and computer programs are the @@ -321,7 +321,6 @@ cupsFileClose(cups_file_t *fp) /* I - CUPS file */ int fd; /* File descriptor */ char mode; /* Open mode */ int status; /* Return status */ - int is_stdio; /* Is a stdio file? */ DEBUG_printf(("cupsFileClose(fp=%p)", (void *)fp)); @@ -410,12 +409,19 @@ cupsFileClose(cups_file_t *fp) /* I - CUPS file */ #endif /* HAVE_LIBZ */ /* + * If this is one of the cupsFileStdin/out/err files, return now and don't + * actually free memory or close (these last the life of the process...) + */ + + if (fp->is_stdio) + return (status); + +/* * Save the file descriptor we used and free memory... */ - fd = fp->fd; - mode = fp->mode; - is_stdio = fp->is_stdio; + fd = fp->fd; + mode = fp->mode; if (fp->printf_buffer) free(fp->printf_buffer); @@ -431,11 +437,8 @@ cupsFileClose(cups_file_t *fp) /* I - CUPS file */ if (httpAddrClose(NULL, fd) < 0) status = -1; } - else if (!is_stdio) - { - if (close(fd) < 0) - status = -1; - } + else if (close(fd) < 0) + status = -1; return (status); } |