OSDN Git Service

nptl: fix sem_open with O_CREAT
authorRoman I Khimov <khimov@altell.ru>
Sun, 2 May 2010 19:45:27 +0000 (23:45 +0400)
committerAustin Foxley <austinf@cetoncorp.com>
Mon, 3 May 2010 20:27:36 +0000 (13:27 -0700)
Temporary file name template passed to __gen_tempname had no "XXXXXX" in it,
so __gen_tempname returned EINVAL which led to sem_open failure.

Fixes NPTL tests tst-sem4, tst-sem7, tst-sem8, tst-sem9.

Signed-off-by: Roman I Khimov <khimov@altell.ru>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
libpthread/nptl/sem_open.c

index 8ded82c..28dd3aa 100644 (file)
@@ -333,7 +333,8 @@ sem_open (const char *name, int oflag, ...)
              sizeof (sem_t) - sizeof (struct new_sem));
 
       tmpfname = (char *) alloca (mountpoint.dirlen + 6 + 1);
-      mempcpy (tmpfname, mountpoint.dir, mountpoint.dirlen);
+      mempcpy (mempcpy (tmpfname, mountpoint.dir, mountpoint.dirlen),
+       "XXXXXX", 7);
 
       fd = __gen_tempname (tmpfname, __GT_FILE, mode);
       if (fd == -1)