Date: Mon, 18 Jan 2010 10:29:04 +0000 (UTC) From: David Xu <davidxu@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r202557 - head/lib/libc/gen Message-ID: <201001181029.o0IAT4Dk031128@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: davidxu Date: Mon Jan 18 10:29:04 2010 New Revision: 202557 URL: http://svn.freebsd.org/changeset/base/202557 Log: preserve errno when processing error cases. Modified: head/lib/libc/gen/sem_new.c Modified: head/lib/libc/gen/sem_new.c ============================================================================== --- head/lib/libc/gen/sem_new.c Mon Jan 18 10:17:51 2010 (r202556) +++ head/lib/libc/gen/sem_new.c Mon Jan 18 10:29:04 2010 (r202557) @@ -142,7 +142,7 @@ _sem_open(const char *name, int flags, . va_list ap; struct sem_nameinfo *ni = NULL; sem_t *sem = NULL; - int fd = -1, mode, len; + int fd = -1, mode, len, errsave; int value = 0; if (name[0] != '/') { @@ -233,12 +233,14 @@ _sem_open(const char *name, int flags, . return (sem); error: + errsave = errno; _pthread_mutex_unlock(&sem_llock); if (fd != -1) _close(fd); if (sem != NULL) munmap(sem, sizeof(sem_t)); free(ni); + errno = errsave; return (SEM_FAILED); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201001181029.o0IAT4Dk031128>