lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lo...@apache.org
Subject [lucy-commits] svn commit: r1373545 - in /lucy/branches/0.3/charmonizer/src/Charmonizer/Core: Compiler.c Util.c
Date Wed, 15 Aug 2012 18:16:01 GMT
Author: logie
Date: Wed Aug 15 18:15:58 2012
New Revision: 1373545

URL: http://svn.apache.org/viewvc?rev=1373545&view=rev
Log:
LUCY-243
Check for remove failures and warn errno.

Modified:
    lucy/branches/0.3/charmonizer/src/Charmonizer/Core/Compiler.c
    lucy/branches/0.3/charmonizer/src/Charmonizer/Core/Util.c

Modified: lucy/branches/0.3/charmonizer/src/Charmonizer/Core/Compiler.c
URL: http://svn.apache.org/viewvc/lucy/branches/0.3/charmonizer/src/Charmonizer/Core/Compiler.c?rev=1373545&r1=1373544&r2=1373545&view=diff
==============================================================================
--- lucy/branches/0.3/charmonizer/src/Charmonizer/Core/Compiler.c (original)
+++ lucy/branches/0.3/charmonizer/src/Charmonizer/Core/Compiler.c Wed Aug 15 18:15:58 2012
@@ -16,6 +16,7 @@
 
 #define CHAZ_USE_SHORT_NAMES
 
+#include <errno.h>
 #include <string.h>
 #include <stdlib.h>
 #include "Charmonizer/Core/Util.h"
@@ -167,11 +168,17 @@ CC_compile_exe(const char *source_path, 
     /* TODO: Key this off the compiler supplied as argument, not the compiler
      * used to compile Charmonizer. */
     sprintf(junk, "%s.obj", exe_name);
-    remove(junk);
+    if ( -1 ==  remove(junk) ) {
+      Util_warn("Error removing [%s] due to the following error: [%s]\n", junk, strerror(errno));
   
+    }
     sprintf(junk, "%s.ilk", exe_name);
-    remove(junk);
+    if ( -1 ==  remove(junk) ) {
+      Util_warn("Error removing [%s] due to the following error: [%s]\n", junk, strerror(errno));
   
+    }
     sprintf(junk, "%s.pdb", exe_name);
-    remove(junk);
+    if ( -1 ==  remove(junk) ) {
+      Util_warn("Error removing [%s] due to the following error: [%s]\n", junk, strerror(errno));
   
+    }
 #endif
 
     /* See if compilation was successful.  Remove the source file. */
@@ -242,7 +249,9 @@ CC_test_compile(const char *source, size
     }
     compile_succeeded = CC_compile_obj(TRY_SOURCE_PATH, TRY_BASENAME,
                                        source, source_len);
-    remove(try_obj_name);
+    if ( -1 ==  remove(try_obj_name) ) {
+      Util_warn("Error removing [%s] due to the following error: [%s]\n", try_obj_name, strerror(errno));
   
+    }
     return compile_succeeded;
 }
 
@@ -271,9 +280,13 @@ CC_capture_output(const char *source, si
     }
 
     /* Remove all the files we just created. */
-    remove(TRY_SOURCE_PATH);
+    if ( -1 ==  remove(TRY_SOURCE_PATH) ) {
+      Util_warn("Error removing [%s] due to the following error: [%s]\n", TRY_SOURCE_PATH,
strerror(errno));    
+    }
     OS_remove_exe(TRY_BASENAME);
-    remove(TARGET_PATH);
+    if ( -1 ==  remove(TARGET_PATH) ) {
+      Util_warn("Error removing [%s] due to the following error: [%s]\n", TARGET_PATH, strerror(errno));
   
+    }
 
     return captured_output;
 }

Modified: lucy/branches/0.3/charmonizer/src/Charmonizer/Core/Util.c
URL: http://svn.apache.org/viewvc/lucy/branches/0.3/charmonizer/src/Charmonizer/Core/Util.c?rev=1373545&r1=1373544&r2=1373545&view=diff
==============================================================================
--- lucy/branches/0.3/charmonizer/src/Charmonizer/Core/Util.c (original)
+++ lucy/branches/0.3/charmonizer/src/Charmonizer/Core/Util.c Wed Aug 15 18:15:58 2012
@@ -133,7 +133,9 @@ Util_warn(const char* format, ...) {
 int
 Util_remove_and_verify(const char *file_path) {
     /* Try to remove the file. */
-    remove(file_path);
+    if ( -1 ==  remove(file_path) ) {
+      Util_warn("Error removing [%s] due to the following error: [%s]\n", file_path, strerror(errno));
   
+    }
 
     /* Return what *might* be success or failure. */
     return Util_can_open_file(file_path) ? 0 : 1;



Mime
View raw message