From: msweet Date: Wed, 6 May 2015 21:00:19 +0000 (+0000) Subject: Check the return value of rename() (STR #4589) X-Git-Tag: v2.2b1~310 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6d8021f4bd0a2a338e2f5d062b8ec2edcd24d9bf;p=thirdparty%2Fcups.git Check the return value of rename() (STR #4589) Add some & in front of function names. git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@12619 a1ca3aef-8c08-0410-bb20-df032aa958be --- diff --git a/CHANGES.txt b/CHANGES.txt index 6d521e17b7..3196a0629e 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,4 @@ -CHANGES.txt - 2.1b1 - 2015-02-27 +CHANGES.txt - 2.1b1 - 2015-05-06 -------------------------------- CHANGES IN CUPS V2.1b1 @@ -26,3 +26,4 @@ CHANGES IN CUPS V2.1b1 () - The cupstestppd program did not handle "maxsize(nnn)" entries in cupsFilter/cupsFilter2 values () + - Now check the return value of rename() calls (STR #4589) \ No newline at end of file diff --git a/cups/auth.c b/cups/auth.c index 1593953d0d..ce9fce694c 100644 --- a/cups/auth.c +++ b/cups/auth.c @@ -311,7 +311,7 @@ _cupsSetNegotiateAuthString( * to use it... */ - if (gss_init_sec_context == NULL) + if (&gss_init_sec_context == NULL) { DEBUG_puts("1_cupsSetNegotiateAuthString: Weak-linked GSSAPI/Kerberos " "framework is not present"); diff --git a/scheduler/colorman.c b/scheduler/colorman.c index ec6507b6bf..8926212c45 100644 --- a/scheduler/colorman.c +++ b/scheduler/colorman.c @@ -368,7 +368,7 @@ apple_register_profiles( * Make sure ColorSync is available... */ - if (ColorSyncRegisterDevice == NULL) + if (&ColorSyncRegisterDevice == NULL) return; /* @@ -868,7 +868,7 @@ apple_unregister_profiles( * Make sure ColorSync is available... */ - if (ColorSyncUnregisterDevice != NULL) + if (&ColorSyncUnregisterDevice != NULL) { CFUUIDRef deviceUUID; /* Device UUID */ diff --git a/scheduler/ipp.c b/scheduler/ipp.c index d775fb7ee6..5b68a494ed 100644 --- a/scheduler/ipp.c +++ b/scheduler/ipp.c @@ -8255,9 +8255,15 @@ print_job(cupsd_client_t *con, /* I - Client connection */ if (add_file(con, job, filetype, compression)) return; - snprintf(filename, sizeof(filename), "%s/d%05d-%03d", RequestRoot, job->id, - job->num_files); - rename(con->filename, filename); + snprintf(filename, sizeof(filename), "%s/d%05d-%03d", RequestRoot, job->id, job->num_files); + if (rename(con->filename, filename)) + { + cupsdLogJob(job, CUPSD_LOG_ERROR, "Unable to rename job document file \"%s\": %s", filename, strerror(errno)); + + send_ipp_status(con, IPP_INTERNAL_ERROR, _("Unable to rename job document file.")); + return; + } + cupsdClearString(&con->filename); /* @@ -9483,9 +9489,14 @@ send_document(cupsd_client_t *con, /* I - Client connection */ if ((attr = ippFindAttribute(job->attrs, "job-k-octets", IPP_TAG_INTEGER)) != NULL) attr->values[0].integer += kbytes; - snprintf(filename, sizeof(filename), "%s/d%05d-%03d", RequestRoot, job->id, - job->num_files); - rename(con->filename, filename); + snprintf(filename, sizeof(filename), "%s/d%05d-%03d", RequestRoot, job->id, job->num_files); + if (rename(con->filename, filename)) + { + cupsdLogJob(job, CUPSD_LOG_ERROR, "Unable to rename job document file \"%s\": %s", filename, strerror(errno)); + + send_ipp_status(con, IPP_INTERNAL_ERROR, _("Unable to rename job document file.")); + return; + } cupsdClearString(&con->filename);