This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[committed] Correct checking for mmap failure


Hi!

Some months ago I stumbled over this -- now I fixed it.  I did not do any
analysis whether there are other such cases.  Pushed as obvious to master
as commit cbc818d0ee66065f3942beffdca82986615aa19a.

commit cbc818d0ee66065f3942beffdca82986615aa19a
Author: Thomas Schwinge <thomas@codesourcery.com>
Date:   Thu Nov 1 00:23:09 2012 +0100

    Correct checking for mmap failure.

diff --git ChangeLog ChangeLog
index 6992adc..1296ee6 100644
--- ChangeLog
+++ ChangeLog
@@ -1,3 +1,7 @@
+2012-10-31  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* rt/tst-shm.c (worker): Correct checking for mmap failure.
+
 2012-10-31  Andreas Schwab  <schwab@linux-m68k.org>
 
 	* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libc.abilist:
diff --git rt/tst-shm.c rt/tst-shm.c
index 92593bd..457b075 100644
--- rt/tst-shm.c
+++ rt/tst-shm.c
@@ -73,7 +73,7 @@ worker (int write_now)
     error (EXIT_FAILURE, 0, "size incorrect");
 
   mem = mmap (NULL, 4000, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
-  if (mem == NULL)
+  if (mem == MAP_FAILED)
     error (EXIT_FAILURE, 0, "mmap failed");
 
   ts.tv_sec = 0;


GrÃÃe,
 Thomas

Attachment: pgp00000.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]