summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2006-01-11 05:48:58 +0000
committerMike Frysinger <vapier@gentoo.org>2006-01-11 05:48:58 +0000
commit0bb5aee5a71065d8cc4b15e89f39e9e83d7cce41 (patch)
tree7891a3ebb1789cf1eed87d63028269b863f4e518 /test
parent2ad663c004252681db182963c301536c1c2e0776 (diff)
cleanup code and dont use %m glibcism
Diffstat (limited to 'test')
-rw-r--r--test/misc/sem.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/test/misc/sem.c b/test/misc/sem.c
index 7606fd180..029386d73 100644
--- a/test/misc/sem.c
+++ b/test/misc/sem.c
@@ -5,39 +5,39 @@
int main(void)
{
- int k, r;
- union semun {
- int val;
- struct semid_ds *buf;
- unsigned short int *array;
- struct seminfo *__buf;
- } sd;
- struct semid_ds sd_buf;
-
- k = semget(IPC_PRIVATE, 10, IPC_CREAT | 0666 );
- printf("%d\n", k);
-
- if (k < 0) {
- printf("semget failed: %m\n");
- return 1;
- }
-
- sd.buf = &sd_buf;
- r = semctl(k, 0, IPC_STAT, sd);
- printf("%d\n", r);
-
- if (r < 0) {
- printf("semctl IPC_STAT failed: %m\n");
- return 1;
- }
-
- printf("sem_nsems = %lu\n", sd_buf.sem_nsems);
- if (sd_buf.sem_nsems != 10) {
- printf("failed: incorrect sem_nsems!\n");
- return 1;
- }
-
- printf("succeeded\n");
-
- return 0;
+ int k, r;
+ union semun {
+ int val;
+ struct semid_ds *buf;
+ unsigned short int *array;
+ struct seminfo *__buf;
+ } sd;
+ struct semid_ds sd_buf;
+
+ k = semget(IPC_PRIVATE, 10, IPC_CREAT | 0666 );
+ printf("semget(IPC_CREAT) = %d\n", k);
+
+ if (k < 0) {
+ fprintf(stderr, "semget failed: %m\n");
+ return 1;
+ }
+
+ sd.buf = &sd_buf;
+ r = semctl(k, 0, IPC_STAT, sd);
+ printf("semctl(k) = %d\n", r);
+
+ if (r < 0) {
+ perror("semctl IPC_STAT failed");
+ return 1;
+ }
+
+ printf("sem_nsems = %lu\n", sd_buf.sem_nsems);
+ if (sd_buf.sem_nsems != 10) {
+ fprintf(stderr, "failed: incorrect sem_nsems!\n");
+ return 1;
+ }
+
+ printf("succeeded\n");
+
+ return 0;
}