Procházet zdrojové kódy

nptl: fix sem_open with O_CREAT

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>
Roman I Khimov před 14 roky
rodič
revize
57d8289291
1 změnil soubory, kde provedl 2 přidání a 1 odebrání
  1. 2 1
      libpthread/nptl/sem_open.c

+ 2 - 1
libpthread/nptl/sem_open.c

@@ -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)