public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/2764] New: Redundant check in the __utmpname() function
@ 2006-06-14  7:49 nikolay dot zhuravlev at auriga dot ru
  2006-08-14  3:58 ` [Bug libc/2764] " drepper at redhat dot com
  0 siblings, 1 reply; 2+ messages in thread
From: nikolay dot zhuravlev at auriga dot ru @ 2006-06-14  7:49 UTC (permalink / raw)
  To: glibc-bugs

The innermost 'if' statement is redundant in the following code:

[login/utmpname.c]
<<<<
if (strcmp (file, __libc_utmp_file_name) != 0)
    {
      if (strcmp (file, default_file_name) == 0)
    {
      if (__libc_utmp_file_name != default_file_name)
        free ((char *) __libc_utmp_file_name);

      __libc_utmp_file_name = default_file_name;
    }
>>>>

If file is the same as the default one, but different from
the __libc_utmp_file_name, then, by definition,
__libc_utmp_file_name != default_file_name.
The patch is provided below.


Index: login/utmpname.c
===================================================================
RCS file: /cvs/glibc/libc/login/utmpname.c,v
retrieving revision 1.6
diff -u -r1.6 utmpname.c
--- login/utmpname.c    13 Mar 2002 05:09:36 -0000      1.6
+++ login/utmpname.c    14 Jun 2006 07:45:05 -0000
@@ -50,7 +50,6 @@
     {
       if (strcmp (file, default_file_name) == 0)
        {
-         if (__libc_utmp_file_name != default_file_name)
            free ((char *) __libc_utmp_file_name);

          __libc_utmp_file_name = default_file_name;

-- 
           Summary: Redundant check in the __utmpname() function
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: minor
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: nikolay dot zhuravlev at auriga dot ru
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=2764

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug libc/2764] Redundant check in the __utmpname() function
  2006-06-14  7:49 [Bug libc/2764] New: Redundant check in the __utmpname() function nikolay dot zhuravlev at auriga dot ru
@ 2006-08-14  3:58 ` drepper at redhat dot com
  0 siblings, 0 replies; 2+ messages in thread
From: drepper at redhat dot com @ 2006-08-14  3:58 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From drepper at redhat dot com  2006-08-14 03:58 -------
I changed this in CVS.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


http://sourceware.org/bugzilla/show_bug.cgi?id=2764

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-08-14  3:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-14  7:49 [Bug libc/2764] New: Redundant check in the __utmpname() function nikolay dot zhuravlev at auriga dot ru
2006-08-14  3:58 ` [Bug libc/2764] " drepper at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).