From: msweet Date: Wed, 11 Nov 2015 19:59:43 +0000 (+0000) Subject: Make sure to delete temporary file on failed install of cupsd.conf X-Git-Tag: v2.2b1~155 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eb93498a8c4bde2c0d531a5bc00bae775f2f76ac;p=thirdparty%2Fcups.git Make sure to delete temporary file on failed install of cupsd.conf () git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@12962 a1ca3aef-8c08-0410-bb20-df032aa958be --- diff --git a/CHANGES-2.1.txt b/CHANGES-2.1.txt index ea0a883706..d2768c96af 100644 --- a/CHANGES-2.1.txt +++ b/CHANGES-2.1.txt @@ -11,7 +11,7 @@ CHANGES IN CUPS V2.1.1 , , , , , , - ) + , ) - The cupsGetPPD* functions did not work with IPP printers (STR #4725) - Some older HP LaserJet printers need a delayed close when printing using the libusb-based USB backend (STR #4549) diff --git a/scheduler/client.c b/scheduler/client.c index b1c880d143..53dc9540db 100644 --- a/scheduler/client.c +++ b/scheduler/client.c @@ -3223,7 +3223,7 @@ install_cupsd_conf(cupsd_client_t *con) /* I - Connection */ { cupsdLogClient(con, CUPSD_LOG_ERROR, "Unable to open request file \"%s\": %s", con->filename, strerror(errno)); - return (HTTP_STATUS_SERVER_ERROR); + goto server_error; } /* @@ -3233,7 +3233,7 @@ install_cupsd_conf(cupsd_client_t *con) /* I - Connection */ if ((out = cupsdCreateConfFile(ConfigurationFile, ConfigFilePerm)) == NULL) { cupsFileClose(in); - return (HTTP_STATUS_SERVER_ERROR); + goto server_error; } cupsdLogClient(con, CUPSD_LOG_INFO, "Installing config file \"%s\"...", @@ -3256,7 +3256,7 @@ install_cupsd_conf(cupsd_client_t *con) /* I - Connection */ snprintf(filename, sizeof(filename), "%s.N", ConfigurationFile); cupsdUnlinkOrRemoveFile(filename); - return (HTTP_STATUS_SERVER_ERROR); + goto server_error; } /* @@ -3266,7 +3266,7 @@ install_cupsd_conf(cupsd_client_t *con) /* I - Connection */ cupsFileClose(in); if (cupsdCloseCreatedConfFile(out, ConfigurationFile)) - return (HTTP_STATUS_SERVER_ERROR); + goto server_error; /* * Remove the request file... @@ -3287,6 +3287,17 @@ install_cupsd_conf(cupsd_client_t *con) /* I - Connection */ */ return (HTTP_STATUS_CREATED); + + /* + * Common exit for errors... + */ + + server_error: + + cupsdUnlinkOrRemoveFile(con->filename); + cupsdClearString(&con->filename); + + return (HTTP_STATUS_SERVER_ERROR); }