mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
* sem_open.c (sem_open): Rewrite initialization of initsem to
avoid warnings.
This commit is contained in:
@ -1,5 +1,8 @@
|
|||||||
2009-04-26 Ulrich Drepper <drepper@redhat.com>
|
2009-04-26 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* sem_open.c (sem_open): Rewrite initialization of initsem to
|
||||||
|
avoid warnings.
|
||||||
|
|
||||||
* sysdeps/unix/sysv/linux/libc_pthread_init.c (__libc_pthread_init):
|
* sysdeps/unix/sysv/linux/libc_pthread_init.c (__libc_pthread_init):
|
||||||
Avoid warning by using may_alias attribute on ptrhack.
|
Avoid warning by using may_alias attribute on ptrhack.
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 2002, 2003, 2006, 2007 Free Software Foundation, Inc.
|
/* Copyright (C) 2002, 2003, 2006, 2007, 2009 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
|
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
|
||||||
|
|
||||||
@ -302,15 +302,18 @@ sem_open (const char *name, int oflag, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Create the initial file content. */
|
/* Create the initial file content. */
|
||||||
|
union
|
||||||
|
{
|
||||||
sem_t initsem;
|
sem_t initsem;
|
||||||
|
struct new_sem newsem;
|
||||||
|
} sem;
|
||||||
|
|
||||||
struct new_sem *iinitsem = (struct new_sem *) &initsem;
|
sem.newsem.value = value;
|
||||||
iinitsem->value = value;
|
sem.newsem.private = 0;
|
||||||
iinitsem->private = 0;
|
sem.newsem.nwaiters = 0;
|
||||||
iinitsem->nwaiters = 0;
|
|
||||||
|
|
||||||
/* Initialize the remaining bytes as well. */
|
/* Initialize the remaining bytes as well. */
|
||||||
memset ((char *) &initsem + sizeof (struct new_sem), '\0',
|
memset ((char *) &sem.initsem + sizeof (struct new_sem), '\0',
|
||||||
sizeof (sem_t) - sizeof (struct new_sem));
|
sizeof (sem_t) - sizeof (struct new_sem));
|
||||||
|
|
||||||
tmpfname = (char *) alloca (mountpoint.dirlen + 6 + 1);
|
tmpfname = (char *) alloca (mountpoint.dirlen + 6 + 1);
|
||||||
@ -349,7 +352,7 @@ sem_open (const char *name, int oflag, ...)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TEMP_FAILURE_RETRY (__libc_write (fd, &initsem, sizeof (sem_t)))
|
if (TEMP_FAILURE_RETRY (__libc_write (fd, &sem.initsem, sizeof (sem_t)))
|
||||||
== sizeof (sem_t)
|
== sizeof (sem_t)
|
||||||
/* Map the sem_t structure from the file. */
|
/* Map the sem_t structure from the file. */
|
||||||
&& (result = (sem_t *) mmap (NULL, sizeof (sem_t),
|
&& (result = (sem_t *) mmap (NULL, sizeof (sem_t),
|
||||||
|
Reference in New Issue
Block a user