Use stat for gmx_is_file. Fix get_libdir with symlinks.
authorRoland Schulz <roland@utk.edu>
Sat, 24 Nov 2012 05:07:35 +0000 (00:07 -0500)
committerRoland Schulz <roland@utk.edu>
Sat, 24 Nov 2012 05:07:35 +0000 (00:07 -0500)
In commit 4e057440520c1 I used lstat instead of stat confusing the
two. The commit tried to fix the misidentification of directories.
There is no need to distinquish between symlinks and files (and
thus break it if a binary is a symlink).

Change-Id: Ie964e826729a35f11516fb3d002ebc01cbb7a564

CMakeLists.txt
src/config.h.cmakein
src/gmxlib/futil.c

index e1c698d21cf333ad42ede5af460d5e365d40f65e..ce84f6a5e3b23d7dcb20f0fd0d37a74c162b1094 100644 (file)
@@ -347,7 +347,6 @@ check_function_exists(fsync             HAVE_FSYNC)
 check_function_exists(_fileno           HAVE__FILENO)
 check_function_exists(fileno            HAVE_FILENO)
 check_function_exists(_commit           HAVE__COMMIT)
-check_function_exists(lstat             HAVE_LSTAT)
 
 include(CheckLibraryExists)
 check_library_exists(m sqrt "" HAVE_LIBM)
index 690c81465261e9846355bab3a885f6114a8da3ca..91873e6dccb8a7f521cc7fd1183b112f3ad9ae79 100644 (file)
 /* Define to 1 if you have the _fileno() function. */
 #cmakedefine HAVE__FILENO
 
-/* Define to 1 if you have the lstat() function. */
-#cmakedefine HAVE_LSTAT
-
 /* Define to 1 if you have the <string.h> header file. */
 #cmakedefine HAVE_STRING_H
 
index ebee084d86623f92eab9bfc47866302875e7bd88..a88fff02b622e647e0f3c8c9c170ab8f9165c9f1 100644 (file)
@@ -334,11 +334,7 @@ static gmx_bool gmx_is_file(const char *fname)
         {
             int status;
             struct stat st_buf;
-            #ifdef HAVE_LSTAT
-                status = lstat (fname, &st_buf);
-            #else
-                status = stat (fname, &st_buf);
-            #endif
+            status = stat (fname, &st_buf);
             if (status != 0 || !S_ISREG(st_buf.st_mode))
             {
                 return FALSE;