]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Make sure to delete temporary file on failed install of cupsd.conf
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Wed, 11 Nov 2015 19:59:43 +0000 (19:59 +0000)
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Wed, 11 Nov 2015 19:59:43 +0000 (19:59 +0000)
(<rdar://problem/23135207>)

git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@12962 a1ca3aef-8c08-0410-bb20-df032aa958be

CHANGES-2.1.txt
scheduler/client.c

index ea0a883706e3406c04c6a781913de947b5654f24..d2768c96afbf8e8245d65d8460da2091f7a62a82 100644 (file)
@@ -11,7 +11,7 @@ CHANGES IN CUPS V2.1.1
          <rdar://problem/23134228>, <rdar://problem/23134299>,
          <rdar://problem/23134356>, <rdar://problem/23134415>,
          <rdar://problem/23134506>, <rdar://problem/23135066>,
-         <rdar://problem/23135122>)
+         <rdar://problem/23135122>, <rdar://problem/23135207>)
        - 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)
index b1c880d14336b5d106f91ea1b1fd29ef20b4f879..53dc9540db9de952ff0a4e6bf8caa99af73edae4 100644 (file)
@@ -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);
 }