Changeset: 1861cb1ab45e for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1861cb1ab45e
Modified Files:
        gdk/gdk_storage.mx
Branch: Apr2011
Log Message:

Don't test whether a file exists before trying unlink.
When unlink finds out that the file doesn't exist, fine.


diffs (39 lines):

diff --git a/gdk/gdk_storage.mx b/gdk/gdk_storage.mx
--- a/gdk/gdk_storage.mx
+++ b/gdk/gdk_storage.mx
@@ -193,27 +193,20 @@
 @-
 Unlink the file.
 @c
-static int
-delete_file(const char *path)
-{
-       int err = unlink(path);
-
-       if (err)
-               GDKsyserror("GDKunlink(%s)\n", path);
-       IODEBUG THRprintf(GDKout, "#unlink %s = %d\n", path, err);
-
-       return err;
-}
-
 int
 GDKunlink(const char *dir, const char *nme, const char *ext)
 {
        char path[PATHLENGTH];
-       struct stat st;
+
        if (nme && *nme) {
                GDKfilepath(path, dir, nme, ext);
-               if (lstat(path, &st) == 0)
-                       return delete_file(path);
+               /* if file already doesn't exist, we don't care */
+               if (unlink(path) == -1 && errno != ENOENT) {
+                       GDKsyserror("GDKunlink(%s)\n", path);
+                       IODEBUG THRprintf(GDKout, "#unlink %s = -1\n", path);
+                       return -1;
+               }
+               return 0;
        }
        return -1;
 }
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to