changed mdrun file locking not supported error to a note
authorBerk Hess <hess@kth.se>
Tue, 17 Apr 2012 15:08:27 +0000 (17:08 +0200)
committerBerk Hess <hess@kth.se>
Tue, 17 Apr 2012 15:08:27 +0000 (17:08 +0200)
On some (file) systems file locking is not supported.
This should not prevent users from using the append option of mdrun,
Fixes #924

Change-Id: I99c0d38eb702b316df0027df3d33befc562a0a7a

src/gmxlib/checkpoint.c

index 543d9e02021688bea3ae663abddeaba9d73a546d..0185893d0af2a2f631c03fabc276b4400e75b53e 100644 (file)
@@ -1752,16 +1752,24 @@ static void read_checkpoint(const char *fn,FILE **pfplog,
                 if (_locking(fileno(gmx_fio_getfp(chksum_file)), _LK_NBLCK, LONG_MAX)==-1)
 #endif
                 {
-                    if (errno!=EACCES && errno!=EAGAIN)
+                    if (errno == ENOSYS)
                     {
-                        gmx_fatal(FARGS,"Failed to lock: %s. %s.",
-                                  outputfiles[i].filename, strerror(errno));
+                        fprintf(stderr,"\nNOTE: File locking is not supported on this system, will not lock %s\n\n",outputfiles[i].filename);
+                        if (fplog)
+                        {
+                            fprintf(fplog,"\nNOTE: File locking not supported on this system, will not lock %s\n\n",outputfiles[i].filename);
+                        }
                     }
-                    else 
+                    else if (errno == EACCES || errno == EAGAIN)
                     {
                         gmx_fatal(FARGS,"Failed to lock: %s. Already running "
                                   "simulation?", outputfiles[i].filename);
                     }
+                    else
+                    {
+                        gmx_fatal(FARGS,"Failed to lock: %s. %s.",
+                                  outputfiles[i].filename, strerror(errno));
+                    }
                 }
             }