diff --git a/test/zdtm/static/dumpable02.c b/test/zdtm/static/dumpable02.c index 16d880adc..cbcd5ba66 100644 --- a/test/zdtm/static/dumpable02.c +++ b/test/zdtm/static/dumpable02.c @@ -87,7 +87,7 @@ int main(int argc, char **argv) */ ret = chmod(argv[0], 0111); if (ret < 0) { - pr_perror("error chmodding %s", argv[0]); + pr_perror("chmod(%s) failed", argv[0]); return 1; } @@ -144,7 +144,7 @@ int main(int argc, char **argv) } execl(argv[0], "dumpable_server", NULL); - pr_perror("could not execv %s as a dumpable_server\nError No: %d", argv[0], errno); + pr_perror("could not execv %s as a dumpable_server", argv[0]); return 1; } diff --git a/test/zdtm/static/inotify_system.c b/test/zdtm/static/inotify_system.c index 456d20e1c..d504647f2 100644 --- a/test/zdtm/static/inotify_system.c +++ b/test/zdtm/static/inotify_system.c @@ -92,8 +92,8 @@ int addWatcher(int fd, const char *path) { int wd; wd = inotify_add_watch(fd, path, IN_ALL_EVENTS | IN_DONT_FOLLOW); if (wd < 0) { - pr_perror("inotify_add_watch(%d, %s, IN_ALL_EVENTS) Failed, %s", - fd, path, strerror(errno)); + pr_perror("inotify_add_watch(%d, %s, IN_ALL_EVENTS) failed", + fd, path); return -1; } return wd; @@ -101,8 +101,7 @@ int addWatcher(int fd, const char *path) { int fChmod(char *path) { if (chmod(path, 0755) < 0) { - pr_perror("chmod(%s, 0755) Failed, %s", - path, strerror(errno)); + pr_perror("chmod(%s, 0755) failed", path); return -1; } return 0; @@ -111,16 +110,15 @@ int fChmod(char *path) { int fWriteClose(char *path) { int fd = open(path, O_RDWR | O_CREAT, 0700); if (fd == -1) { - pr_perror("open(%s, O_RDWR|O_CREAT,0700) Failed, %s", - path, strerror(errno)); + pr_perror("open(%s, O_RDWR|O_CREAT, 0700) failed", path); return -1; } if (write(fd, "string", 7) == -1) { - pr_perror("write(%d, %s, 1) Failed, %s", fd, path, strerror(errno)); + pr_perror("write(%d, %s, 1) failed", fd, path); return -1; } if (close(fd) == -1) { - pr_perror("close(%s) Failed, %s", path, strerror(errno)); + pr_perror("close(%s) failed", path); return -1; } return 0; @@ -130,17 +128,16 @@ int fNoWriteClose(char *path) { char buf[BUF_SIZE]; int fd = open(path, O_RDONLY); if ( fd < 0 ) { - pr_perror("open(%s, O_RDONLY) Failed, %s", - path, strerror(errno)); + pr_perror("open(%s, O_RDONLY) failed", path); return -1; } if (read(fd, buf, BUF_SIZE) == -1) { - pr_perror("read error: %s", strerror(errno)); + pr_perror("read"); close(fd); return -1; } if (close(fd) == -1) { - pr_perror("close(%s) Failed, %s", path, strerror(errno)); + pr_perror("close(%s) failed", path); return -1; } return 0; @@ -148,8 +145,7 @@ int fNoWriteClose(char *path) { int fMove(char *from, char *to) { if (rename(from, to) == -1) { - pr_perror("rename error (from: %s to: %s) : %s", - from, to, strerror(errno)); + pr_perror("rename error (from: %s to: %s)", from, to); return -1; } return 0; @@ -158,13 +154,12 @@ int fMove(char *from, char *to) { desc init_env(const char *dir, char *file_path, char *link_path) { desc in_desc = {-1, -1, -1, -1}; if (mkdir(dir, 0777) < 0) { - pr_perror("error in creating directory: %s, %s", - dir, strerror(errno)); + pr_perror("mkdir(%s)", dir); return in_desc; } in_desc.inot = inotify_init(); if (in_desc.inot < 0) { - pr_perror("inotify_init () Failed, %s", strerror(errno)); + pr_perror("inotify_init() failed"); rmdir(dir); return in_desc; } @@ -193,7 +188,7 @@ desc init_env(const char *dir, char *file_path, char *link_path) { int fDelete(char *path) { if (unlink(path) != 0) { - pr_perror("unlink: (%s)", strerror(errno)); + pr_perror("unlink(%s)", path); return -1; } return 0; @@ -201,7 +196,7 @@ int fDelete(char *path) { int fRemDir(const char *target) { if(rmdir(target)) { - pr_perror("rmdir: (%s)", strerror(errno)); + pr_perror("rmdir(%s)", target); return -1; } return 0; @@ -295,8 +290,8 @@ next_event: int read_set(int inot_fd, char *event_set) { int len; if ((len = read(inot_fd, event_set, EVENT_BUF_LEN)) < 0) { - pr_perror("read(%d, buf, %lu) Failed, errno=%d", - inot_fd, (unsigned long)EVENT_BUF_LEN, errno); + pr_perror("read(%d, buf, %lu) failed", + inot_fd, (unsigned long)EVENT_BUF_LEN); return -1; } return len; diff --git a/test/zdtm/static/ipc_namespace.c b/test/zdtm/static/ipc_namespace.c index e185c0aea..da400db6c 100644 --- a/test/zdtm/static/ipc_namespace.c +++ b/test/zdtm/static/ipc_namespace.c @@ -100,7 +100,7 @@ static int get_messages_info(struct ipc_ns *ipc) ret = msgctl(0, MSG_INFO, (struct msqid_ds *)&info); if (ret < 0) { - pr_perror("msgctl failed with %d", errno); + pr_perror("msgctl failed"); return ret; } @@ -149,7 +149,7 @@ static int get_semaphores_info(struct ipc_ns *ipc) err = semctl(0, 0, SEM_INFO, &info); if (err < 0) - pr_perror("semctl failed with %d", errno); + pr_perror("semctl failed"); ipc->sem_ctls[0] = info.semmsl; ipc->sem_ctls[1] = info.semmns; @@ -172,7 +172,7 @@ static int get_shared_memory_info(struct ipc_ns *ipc) ret = shmctl(0, IPC_INFO, &u.shmid); if (ret < 0) - pr_perror("semctl failed with %d", errno); + pr_perror("semctl failed"); ipc->shm_ctlmax = u.shminfo64.shmmax; ipc->shm_ctlall = u.shminfo64.shmall; @@ -180,7 +180,7 @@ static int get_shared_memory_info(struct ipc_ns *ipc) ret = shmctl(0, SHM_INFO, &u.shmid); if (ret < 0) - pr_perror("semctl failed with %d", errno); + pr_perror("semctl failed"); ipc->shm_tot = u.shminfo.shm_tot; ipc->ids[IPC_SHM_IDS].in_use = u.shminfo.used_ids; @@ -256,7 +256,7 @@ static int rand_ipc_sem(void) (unsigned) lrand48(), (unsigned) lrand48() % MAX_MNI); ret = write(fd, buf, 128); if (ret < 0) { - pr_perror("Can't write %s: %d", name, errno); + pr_perror("Can't write %s", name); return -errno; } close(fd); diff --git a/test/zdtm/static/mtime_mmap.c b/test/zdtm/static/mtime_mmap.c index 64d92ca99..c2e2bddb7 100644 --- a/test/zdtm/static/mtime_mmap.c +++ b/test/zdtm/static/mtime_mmap.c @@ -54,7 +54,7 @@ int main(int argc, char **argv) ptr = (char *)mmap(NULL, count, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); if (ptr == MAP_FAILED) { - pr_perror("mmap() Failed, errno=%d : %s", errno, strerror(errno)); + pr_perror("mmap() failed"); goto failed; } @@ -66,12 +66,12 @@ int main(int argc, char **argv) ptr[i]++; if (munmap(ptr, count)) { - pr_perror("munmap Failed, errno=%d : %s", errno, strerror(errno)); + pr_perror("munmap failed"); goto failed; } if (fstat(fd, &fst) < 0) { - pr_perror("can't get %s file info", filename); + pr_perror("fstat(%s) failed", filename); goto failed; } diff --git a/test/zdtm/static/shm.c b/test/zdtm/static/shm.c index 23941389a..5ec0fd73e 100644 --- a/test/zdtm/static/shm.c +++ b/test/zdtm/static/shm.c @@ -29,14 +29,14 @@ static int fill_shm_seg(int id, size_t size) mem = shmat(id, NULL, 0); if (mem == (void *)-1) { - pr_perror("Can't attach shm: %d", -errno); + pr_perror("Can't attach shm"); return -1; } datagen(mem, size, &crc); if (shmdt(mem) < 0) { - pr_perror("Can't detach shm: %d", -errno); + pr_perror("Can't detach shm"); return -1; } return 0; @@ -48,7 +48,7 @@ static int get_shm_seg(int key, size_t size, unsigned int flags) id = shmget(key, size, 0777 | flags); if (id == -1) { - pr_perror("Can't get shm: %d", -errno); + pr_perror("Can't get shm"); return -1; } return id; @@ -74,7 +74,7 @@ static int check_shm_id(int id, size_t size) mem = shmat(id, NULL, 0); if (mem == (void *)-1) { - pr_perror("Can't attach shm: %d", -errno); + pr_perror("Can't attach shm"); return -1; } crc = INIT_CRC; @@ -83,7 +83,7 @@ static int check_shm_id(int id, size_t size) return -1; } if (shmdt(mem) < 0) { - pr_perror("Can't detach shm: %d", -errno); + pr_perror("Can't detach shm"); return -1; } return 0;