PERFORCE change 38294 for review
Hrishikesh Dandekar
hdandeka at FreeBSD.org
Fri Sep 19 21:42:04 GMT 2003
http://perforce.freebsd.org/chv.cgi?CH=38294
Change 38294 by hdandeka at hdandeka_yash on 2003/09/19 14:41:20
Bug fix.
Affected files ...
.. //depot/projects/trustedbsd/mac/lib/libc/sys/sem.c#6 edit
Differences ...
==== //depot/projects/trustedbsd/mac/lib/libc/sys/sem.c#6 (text+ko) ====
@@ -117,25 +117,18 @@
if (pshared != 0) {
if ((retval = ksem_init(&semid, value))) {
errno = retval;
- retval = -1;
- goto RETURN;
+ return (-1);
}
got_system_sem = 1;
}
(*sem) = sem_alloc(value, semid, got_system_sem);
- if ((*sem) == NULL)
- retval = -1;
- else
- retval = 0;
- RETURN:
- if (retval != 0 && got_system_sem)
- if ((retval = ksem_destroy(semid))) {
- errno = retval;
- retval = -1;
- }
-
- return retval;
+ if ((*sem) == NULL) {
+ errno = ENOSPC;
+ ksem_destroy(semid);
+ return (-1);
+ }
+ return (0);
}
int
@@ -224,10 +217,7 @@
return (sem);
err:
_pthread_mutex_unlock(&named_sems_mtx);
- if ((retval = ksem_close(semid))) {
- errno = retval;
- return (SEM_FAILED);
- }
+ ksem_close(semid);
if (sem != NULL) {
if (*sem != NULL)
sem_free(*sem);
@@ -286,7 +276,9 @@
errno = retval;
return (-1);
}
+ return (0);
}
+ retval = 0;
_pthread_mutex_lock(&(*sem)->lock);
@@ -299,8 +291,6 @@
_pthread_mutex_unlock(&(*sem)->lock);
- retval = 0;
- RETURN:
return retval;
}
@@ -316,6 +306,7 @@
errno = retval;
return (-1);
}
+ return (0);
}
_pthread_mutex_lock(&(*sem)->lock);
@@ -330,7 +321,6 @@
_pthread_mutex_unlock(&(*sem)->lock);
- RETURN:
return retval;
}
@@ -346,8 +336,10 @@
errno = retval;
return (-1);
}
+ return (0);
}
+ retval = 0;
_pthread_mutex_lock(&(*sem)->lock);
(*sem)->count++;
@@ -356,8 +348,6 @@
_pthread_mutex_unlock(&(*sem)->lock);
- retval = 0;
- RETURN:
return retval;
}
@@ -373,13 +363,13 @@
errno = retval;
return (-1);
}
+ return (0);
}
+ retval = 0;
_pthread_mutex_lock(&(*sem)->lock);
*sval = (int)(*sem)->count;
_pthread_mutex_unlock(&(*sem)->lock);
- retval = 0;
- RETURN:
return retval;
}
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message
More information about the trustedbsd-cvs
mailing list