TNG Fix for GMX_DOUBLE builds and where ZLIB is not available.
[alexxy/gromacs.git] / src / gromacs / fileio / tngio.cpp
index 1fea9473e73b1ed3947bd897315ca7d045f98af4..fb8b8f6dcb39e15966351fcfdca1e111be1a90d9 100644 (file)
@@ -149,10 +149,12 @@ void gmx_tng_open(const char       *filename,
 
 #ifdef HAVE_UNISTD_H
         char username[256];
-        getlogin_r(username, 256);
-        if (mode == 'w')
+        if (!getlogin_r(username, 256))
         {
-            tng_first_user_name_set(*tng, username);
+            if (mode == 'w')
+            {
+                tng_first_user_name_set(*tng, username);
+            }
         }
 /* TODO: This should be implemented when the above fixme is done (adding data to
  * the header). */