Update of /cvsroot/monetdb/sql/src/backends/monet5/merovingian
In directory 
sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv17714/src/backends/monet5/merovingian

Modified Files:
        database.c 
Log Message:
propagated changes of Friday Mar 05 2010 - Wednesday Mar 10 2010
from the Feb2010 branch to the development trunk

  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2010/03/05 - mr-meltdown: src/backends/monet5/merovingian/database.c,1.11.2.1
  check return of fopen() in more places, as pointed out by Mark Bucciarelli
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Index: database.c
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/merovingian/database.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- database.c  7 Jan 2010 15:24:31 -0000       1.11
+++ database.c  10 Mar 2010 14:29:38 -0000      1.12
@@ -118,11 +118,17 @@
        /* put this database under maintenance, make sure no race condition
         * ever can happen, by putting it under maintenance before it even
         * exists for Merovingian */
-       fclose(fopen(path, "w"));
+       if ((f = fopen(path, "w")) != NULL)
+               fclose(f); /* if this fails, below probably fails too */
 
        /* avoid GDK making fugly complaints */
        snprintf(path, sizeof(path), "%s/%s/.gdk_lock", dbfarm, dbname);
-       f = fopen(path, "w");
+       if ((f = fopen(path, "w")) == NULL) {
+               snprintf(buf, sizeof(buf), "cannot write lock file: %s",
+                               strerror(errno));
+               GDKfree(dbfarm);
+               return(strdup(buf));
+       }
        /* to all insanity, .gdk_lock is "valid" if it contains a
         * ':', which it does by pure coincidence of time having a
         * ':' in there twice... */


------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

Reply via email to