]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
(pututline_file): Don't always report success if similar entry is
authorUlrich Drepper <drepper@redhat.com>
Fri, 30 Jan 1998 17:01:30 +0000 (17:01 +0000)
committerUlrich Drepper <drepper@redhat.com>
Fri, 30 Jan 1998 17:01:30 +0000 (17:01 +0000)
found.

login/utmp_file.c

index 403b4e5d6a81e325dcf7d5d7d900c537515f258b..a52215e74d8eea4ec6f710898b06622f491494bb 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>
    and Paul Janzen <pcj@primenet.com>, 1996.
@@ -381,12 +381,12 @@ pututline_file (const struct utmp *data)
     }
 
   /* Write the new data.  */
-  if (write (file_fd, data, sizeof (struct utmp)) != sizeof (struct utmp)
+  if (write (file_fd, data, sizeof (struct utmp)) != sizeof (struct utmp))
+    {
       /* If we appended a new record this is only partially written.
         Remove it.  */
-      && found < 0)
-    {
-      (void) ftruncate (file_fd, file_offset);
+      if (found < 0)
+       (void) ftruncate (file_fd, file_offset);
       pbuf = NULL;
     }
   else