From: AZero13 Date: Tue, 4 Nov 2025 00:55:13 +0000 (-0500) Subject: Do not allow negative file descriptors to be closed X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F1408%2Fhead;p=thirdparty%2Fcups.git Do not allow negative file descriptors to be closed Especially --- diff --git a/backend/lpd.c b/backend/lpd.c index bc13c6f6bf..6a5f32ad66 100644 --- a/backend/lpd.c +++ b/backend/lpd.c @@ -523,7 +523,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ if (tmpfilename[0]) unlink(tmpfilename); - if (fd) + if (fd > 0) close(fd); if (snmp_fd >= 0) @@ -948,7 +948,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */ * Next, open the print file and figure out its size... */ - if (print_fd) + if (print_fd > 0) { /* * Use the size from the print file... diff --git a/filter/rastertoepson.c b/filter/rastertoepson.c index 644e81e5e2..9de3986935 100644 --- a/filter/rastertoepson.c +++ b/filter/rastertoepson.c @@ -1141,7 +1141,7 @@ main(int argc, /* I - Number of command-line arguments */ */ cupsRasterClose(ras); - if (fd != 0) + if (fd > 0) close(fd); /* diff --git a/filter/rastertohp.c b/filter/rastertohp.c index d2743b2dd2..bb942c3595 100644 --- a/filter/rastertohp.c +++ b/filter/rastertohp.c @@ -813,7 +813,7 @@ main(int argc, /* I - Number of command-line arguments */ */ cupsRasterClose(ras); - if (fd != 0) + if (fd > 0) close(fd); /* diff --git a/filter/rastertolabel.c b/filter/rastertolabel.c index 8f75e9a176..e196b8685b 100644 --- a/filter/rastertolabel.c +++ b/filter/rastertolabel.c @@ -1263,7 +1263,7 @@ main(int argc, /* I - Number of command-line arguments */ */ cupsRasterClose(ras); - if (fd != 0) + if (fd > 0) close(fd); /* diff --git a/filter/rastertopwg.c b/filter/rastertopwg.c index 9c50f71a74..6ef0975d25 100644 --- a/filter/rastertopwg.c +++ b/filter/rastertopwg.c @@ -490,7 +490,7 @@ main(int argc, /* I - Number of command-line args */ } cupsRasterClose(inras); - if (fd) + if (fd > 0) close(fd); cupsRasterClose(outras);