From: Ulrich Drepper Date: Fri, 30 Jan 1998 17:01:30 +0000 (+0000) Subject: (pututline_file): Don't always report success if similar entry is X-Git-Tag: cvs/before-sparc-2_0_x-branch~263 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=28347e0c30930b352053966f8717632a0f73d67f;p=thirdparty%2Fglibc.git (pututline_file): Don't always report success if similar entry is found. --- diff --git a/login/utmp_file.c b/login/utmp_file.c index 403b4e5d6a8..a52215e74d8 100644 --- a/login/utmp_file.c +++ b/login/utmp_file.c @@ -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 and Paul Janzen , 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