about summary refs log tree commit diff
path: root/sysdeps/unix/getlogin.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/getlogin.c')
-rw-r--r--sysdeps/unix/getlogin.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sysdeps/unix/getlogin.c b/sysdeps/unix/getlogin.c
index 7446f25786..246b488f51 100644
--- a/sysdeps/unix/getlogin.c
+++ b/sysdeps/unix/getlogin.c
@@ -35,7 +35,7 @@ DEFUN_VOID(getlogin)
   char tty_pathname[2 + 2 * NAME_MAX];
   char *real_tty_path = tty_pathname;
   char *result = NULL;
-  static struct utmp_data utmp_data;
+  static struct utmp_data utmp_data = { ut_fd: -1 };
   struct utmp *ut, line;
 
   {
@@ -48,7 +48,7 @@ DEFUN_VOID(getlogin)
       err = errno;
     (void) close (d);
 
-    if (errno != 0)
+    if (err != 0)
       {
 	errno = err;
 	return NULL;