From f54e316eb01cc144b8973cc2ee2ff56941db7a59 Mon Sep 17 00:00:00 2001 From: Andrew Vagin Date: Tue, 20 Oct 2015 17:51:00 +0300 Subject: [PATCH] zdtm: don't supply \n for err() err() adds %m and \n at the end Signed-off-by: Andrew Vagin Signed-off-by: Pavel Emelyanov --- test/zdtm/lib/test.c | 28 +++++----- test/zdtm/live/static/bind-mount.c | 2 +- test/zdtm/live/static/caps00.c | 4 +- test/zdtm/live/static/child_opened_proc.c | 8 +-- test/zdtm/live/static/clean_mntns.c | 4 +- test/zdtm/live/static/cow00.c | 4 +- test/zdtm/live/static/cwd00.c | 8 +-- test/zdtm/live/static/cwd01.c | 8 +-- test/zdtm/live/static/cwd02.c | 8 +-- test/zdtm/live/static/deleted_dev.c | 4 +- test/zdtm/live/static/deleted_unix_sock.c | 6 +-- test/zdtm/live/static/env00.c | 2 +- test/zdtm/live/static/fanotify00.c | 18 +++---- test/zdtm/live/static/fdt_shared.c | 14 ++--- test/zdtm/live/static/fifo-ghost.c | 16 +++--- test/zdtm/live/static/fifo-rowo-pair.c | 24 ++++----- test/zdtm/live/static/fifo.c | 8 +-- test/zdtm/live/static/fifo_ro.c | 10 ++-- test/zdtm/live/static/fifo_wronly.c | 10 ++-- test/zdtm/live/static/file_attr.c | 8 +-- test/zdtm/live/static/file_fown.c | 2 +- test/zdtm/live/static/file_locks00.c | 6 +-- test/zdtm/live/static/file_locks01.c | 2 +- test/zdtm/live/static/file_locks02.c | 2 +- test/zdtm/live/static/file_locks03.c | 2 +- test/zdtm/live/static/file_locks04.c | 2 +- test/zdtm/live/static/futex.c | 6 +-- test/zdtm/live/static/get_smaps_bits.c | 2 +- test/zdtm/live/static/inotify00.c | 2 +- test/zdtm/live/static/ipc_namespace.c | 60 +++++++++++----------- test/zdtm/live/static/maps00.c | 10 ++-- test/zdtm/live/static/maps02.c | 4 +- test/zdtm/live/static/mountpoints.c | 6 +-- test/zdtm/live/static/mtime_mmap.c | 10 ++-- test/zdtm/live/static/overmount_dev.c | 6 +-- test/zdtm/live/static/overmount_fifo.c | 6 +-- test/zdtm/live/static/overmount_file.c | 4 +- test/zdtm/live/static/overmount_sock.c | 6 +-- test/zdtm/live/static/pdeath_sig.c | 2 +- test/zdtm/live/static/posix_timers.c | 18 +++---- test/zdtm/live/static/pthread01.c | 12 ++--- test/zdtm/live/static/ptrace_sig.c | 6 +-- test/zdtm/live/static/pty02.c | 4 +- test/zdtm/live/static/rmdir_open.c | 6 +-- test/zdtm/live/static/rtc.c | 2 +- test/zdtm/live/static/selfexe00.c | 4 +- test/zdtm/live/static/session01.c | 2 +- test/zdtm/live/static/session02.c | 2 +- test/zdtm/live/static/session03.c | 4 +- test/zdtm/live/static/shm.c | 10 ++-- test/zdtm/live/static/sigpending.c | 8 +-- test/zdtm/live/static/sk-unix-unconn.c | 4 +- test/zdtm/live/static/socket-tcp.c | 2 +- test/zdtm/live/static/unhashed_proc.c | 10 ++-- test/zdtm/live/static/unlink_fifo.c | 4 +- test/zdtm/live/static/unlink_fifo_wronly.c | 6 +-- test/zdtm/live/static/unlink_fstat00.c | 16 +++--- test/zdtm/live/static/unlink_fstat01.c | 12 ++--- test/zdtm/live/static/unlink_fstat02.c | 18 +++---- test/zdtm/live/static/unlink_fstat03.c | 14 ++--- test/zdtm/live/static/unlink_largefile.c | 8 +-- test/zdtm/live/static/uptime_grow.c | 4 +- test/zdtm/live/static/utsname.c | 8 +-- test/zdtm/live/static/vdso01.c | 14 ++--- test/zdtm/live/static/wait00.c | 2 +- test/zdtm/live/static/write_read00.c | 4 +- test/zdtm/live/static/write_read01.c | 8 +-- test/zdtm/live/static/write_read02.c | 6 +-- test/zdtm/live/static/write_read10.c | 8 +-- test/zdtm/live/static/zombie00.c | 2 +- test/zdtm/live/streaming/fifo_dyn.c | 14 ++--- 71 files changed, 288 insertions(+), 288 deletions(-) diff --git a/test/zdtm/lib/test.c b/test/zdtm/lib/test.c index 60b67d8ef..fe0e64854 100644 --- a/test/zdtm/lib/test.c +++ b/test/zdtm/lib/test.c @@ -75,7 +75,7 @@ static void redir_stdfds() nullfd = open("/dev/null", O_RDWR); if (nullfd < 0) { - err("Can't open /dev/null: %m\n"); + err("Can't open /dev/null"); exit(1); } @@ -174,13 +174,13 @@ void test_init(int argc, char **argv) pidf = fopen(pidfile, "wx"); if (!pidf) { - err("Can't create pid file %s: %m\n", pidfile); + err("Can't create pid file %s", pidfile); exit(1); } pid = fork(); if (pid < 0) { - err("Daemonizing failed: %m\n"); + err("Daemonizing failed"); exit(1); } @@ -192,11 +192,11 @@ void test_init(int argc, char **argv) waitpid(pid, &ret, 0); if (WIFEXITED(ret)) { - err("Test exited with unexpectedly with code %d\n", WEXITSTATUS(ret)); + err("Test exited with unexpectedly with code %d", WEXITSTATUS(ret)); exit(0); } if (WIFSIGNALED(ret)) { - err("Test exited on unexpected signal %d\n", WTERMSIG(ret)); + err("Test exited on unexpected signal %d", WTERMSIG(ret)); exit(0); } } @@ -209,7 +209,7 @@ void test_init(int argc, char **argv) fclose(pidf); if (setsid() < 0) { - err("Can't become session group leader: %m\n"); + err("Can't become session group leader"); exit(1); } @@ -219,7 +219,7 @@ skip_pid: sa.sa_handler = SIG_DFL; if (sigaction(SIGCHLD, &sa, NULL)) { - err("Can't reset SIGCHLD handler: %m\n"); + err("Can't reset SIGCHLD handler"); exit(1); } @@ -252,12 +252,12 @@ static int do_test_fn(void *_arg) sigemptyset(&sa.sa_mask); if (sigaction(SIGCHLD, &sa, NULL)) { - err("Can't reset SIGCHLD handler: %m\n"); + err("Can't reset SIGCHLD handler"); exit(1); } if (setsid() < 0) { - err("Can't become session group leader: %m\n"); + err("Can't become session group leader"); exit(1); } @@ -302,7 +302,7 @@ void test_init_ns(int argc, char **argv, unsigned long clone_flags, pidf = fopen(pidfile, "wx"); if (!pidf) { - err("Can't create pid file %s: %m\n", pidfile); + err("Can't create pid file %s", pidfile); exit(1); } @@ -312,7 +312,7 @@ void test_init_ns(int argc, char **argv, unsigned long clone_flags, ca.argv = argv; pid = clone(do_test_fn, ca.stack_ptr, clone_flags | SIGCHLD, &ca); if (pid < 0) { - err("Daemonizing failed: %m\n"); + err("Daemonizing failed"); exit(1); } @@ -324,11 +324,11 @@ void test_init_ns(int argc, char **argv, unsigned long clone_flags, waitpid(pid, &ret, 0); if (WIFEXITED(ret)) { - err("Test exited with unexpectedly with code %d\n", WEXITSTATUS(ret)); + err("Test exited with unexpectedly with code %d", WEXITSTATUS(ret)); exit(0); } if (WIFSIGNALED(ret)) { - err("Test exited on unexpected signal %d\n", WTERMSIG(ret)); + err("Test exited on unexpected signal %d", WTERMSIG(ret)); exit(0); } } @@ -344,7 +344,7 @@ void test_daemon() ppid = getppid(); if (ppid <= 1) { - err("Test orphaned\n"); + err("Test orphaned"); goto out; } diff --git a/test/zdtm/live/static/bind-mount.c b/test/zdtm/live/static/bind-mount.c index 619306f9d..d4f9a4f2b 100644 --- a/test/zdtm/live/static/bind-mount.c +++ b/test/zdtm/live/static/bind-mount.c @@ -42,7 +42,7 @@ int main(int argc, char **argv) fd = open(test_file, O_CREAT | O_WRONLY | O_EXCL, 0600); if (fd < 0) { - err("Unable to open %s\n", test_file); + err("Unable to open %s", test_file); return 1; } close(fd); diff --git a/test/zdtm/live/static/caps00.c b/test/zdtm/live/static/caps00.c index 967f4fbf9..87179c52c 100644 --- a/test/zdtm/live/static/caps00.c +++ b/test/zdtm/live/static/caps00.c @@ -55,7 +55,7 @@ int main(int argc, char **argv) test_msg("/proc/sys/kernel/cap_last_cap is not available\n"); if (pipe(result_pipe)) { - err("Can't create pipe\n"); + err("Can't create pipe"); return 1; } @@ -83,7 +83,7 @@ int main(int argc, char **argv) data[0].prm &= ~(1 << CAP_DAC_OVERRIDE); if (capset(&hdr, data) < 0) { - err("capset\n"); + err("capset"); return -1; } diff --git a/test/zdtm/live/static/child_opened_proc.c b/test/zdtm/live/static/child_opened_proc.c index 06f37cfd7..b7e7f1baa 100644 --- a/test/zdtm/live/static/child_opened_proc.c +++ b/test/zdtm/live/static/child_opened_proc.c @@ -34,7 +34,7 @@ int main(int argc, char ** argv) sprintf(name, "/proc/%d/stat", pid); proc_fd = open(name, O_RDONLY); if (proc_fd == -1) { - err("can't open %s: %m\n", name); + err("can't open %s", name); err++; goto out; } @@ -42,16 +42,16 @@ int main(int argc, char ** argv) test_waitsig(); if (close(proc_fd) == -1) { - err("Failed to close %s\n", name); + err("Failed to close %s", name); err++; } out: if (kill(pid, SIGTERM) == -1) { - err("Failed to terminate child\n"); + err("Failed to terminate child"); err++; } else { if (waitpid(pid, NULL, 0) != pid) { - err("Failed to collect killed child\n"); + err("Failed to collect killed child"); err++; } } diff --git a/test/zdtm/live/static/clean_mntns.c b/test/zdtm/live/static/clean_mntns.c index 9f5f1408b..defba0782 100644 --- a/test/zdtm/live/static/clean_mntns.c +++ b/test/zdtm/live/static/clean_mntns.c @@ -12,10 +12,10 @@ int main(int argc, char **argv) test_init(argc, argv); if (umount("/proc") < 0) - err("Can't umount proc\n"); + err("Can't umount proc"); if (umount("/dev/pts") < 0) - err("Can't umount devpts\n"); + err("Can't umount devpts"); test_daemon(); test_waitsig(); diff --git a/test/zdtm/live/static/cow00.c b/test/zdtm/live/static/cow00.c index 2782c2d0b..bcb1595bc 100644 --- a/test/zdtm/live/static/cow00.c +++ b/test/zdtm/live/static/cow00.c @@ -73,7 +73,7 @@ int main(int argc, char ** argv) addr = mmap(NULL, PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (addr == MAP_FAILED) { - err("Can't allocate memory\n"); + err("Can't allocate memory"); return 1; } @@ -81,7 +81,7 @@ int main(int argc, char ** argv) pid = test_fork(); if (pid < 0) { - err("Unable to fork a new process\n"); + err("Unable to fork a new process"); return 1; } else if (pid == 0) { test_waitsig(); diff --git a/test/zdtm/live/static/cwd00.c b/test/zdtm/live/static/cwd00.c index e725bfc1b..e7240a6eb 100644 --- a/test/zdtm/live/static/cwd00.c +++ b/test/zdtm/live/static/cwd00.c @@ -28,17 +28,17 @@ int main(int argc, char **argv) } if (mkdir(dirname, 0700)) { - err("can't make directory %s: %m\n", dirname); + err("can't make directory %s", dirname); exit(1); } if (chdir(dirname)) { - err("can't change directory to %s: %m\n", dirname); + err("can't change directory to %s", dirname); goto cleanup; } if (!getcwd(cwd1, sizeof(cwd1))) { - err("can't get cwd: %m\n"); + err("can't get cwd"); goto cleanup; } @@ -61,7 +61,7 @@ cleanup: exit(1); } if (rmdir(dirname)) { - err("can't remove directory %s: %m\n", dirname); + err("can't remove directory %s", dirname); exit(1); } return 0; diff --git a/test/zdtm/live/static/cwd01.c b/test/zdtm/live/static/cwd01.c index a0a9f8a42..2adecd69e 100644 --- a/test/zdtm/live/static/cwd01.c +++ b/test/zdtm/live/static/cwd01.c @@ -40,12 +40,12 @@ int main(int argc, char **argv) } if (mkdir(dirname, 0700)) { - err("can't make directory %s: %m\n", dirname); + err("can't make directory %s", dirname); exit(1); } if (chdir(dirname)) { - err("can't change directory to %s: %m\n", dirname); + err("can't change directory to %s", dirname); goto cleanup; } @@ -53,13 +53,13 @@ int main(int argc, char **argv) close(p[0]); waitpid(pid, &aux, 0); if (!WIFEXITED(aux) || WEXITSTATUS(aux) != 0) { - err("can't remove dir\n"); + err("can't remove dir"); goto cleanup; } aux = readlink("/proc/self/cwd", cwd1, sizeof(cwd1)); if (aux < 0) { - err("can't get cwd: %m\n"); + err("can't get cwd"); goto cleanup; } if (aux == sizeof(cwd1)) { diff --git a/test/zdtm/live/static/cwd02.c b/test/zdtm/live/static/cwd02.c index 173ddb4a7..c4bcf30b1 100644 --- a/test/zdtm/live/static/cwd02.c +++ b/test/zdtm/live/static/cwd02.c @@ -37,17 +37,17 @@ int main(int argc, char **argv) } if (mkdir(dirname, 0700)) { - err("can't make directory %s: %m\n", dirname); + err("can't make directory %s", dirname); exit(1); } if ((fd = open(dirname, O_DIRECTORY)) < 0) { - err("can't open dir %s: %m\n", dirname); + err("can't open dir %s", dirname); goto cleanup; } if (chdir(dirname)) { - err("can't change directory to %s: %m\n", dirname); + err("can't change directory to %s", dirname); goto cleanup; } @@ -55,7 +55,7 @@ int main(int argc, char **argv) close(p[0]); waitpid(pid, &aux, 0); if (!WIFEXITED(aux) || WEXITSTATUS(aux) != 0) { - err("can't remove dir\n"); + err("can't remove dir"); goto cleanup; } diff --git a/test/zdtm/live/static/deleted_dev.c b/test/zdtm/live/static/deleted_dev.c index 1b046e14f..75d769f63 100644 --- a/test/zdtm/live/static/deleted_dev.c +++ b/test/zdtm/live/static/deleted_dev.c @@ -25,13 +25,13 @@ int main(int argc, char **argv) test_init(argc, argv); if (mknod(filename, mode, dev)) { - err("can't make device file \"%s\": %m\n", filename); + err("can't make device file \"%s\"", filename); exit(1); } fd = open(filename, O_RDWR); if (fd < 0) { - err("can't open %s: %m\n", filename); + err("can't open %s", filename); goto out; } diff --git a/test/zdtm/live/static/deleted_unix_sock.c b/test/zdtm/live/static/deleted_unix_sock.c index 7757280b3..d088c71ff 100644 --- a/test/zdtm/live/static/deleted_unix_sock.c +++ b/test/zdtm/live/static/deleted_unix_sock.c @@ -53,7 +53,7 @@ static int setup_srv_sock(void) } if (listen(sock, 1) < 0) { - err("can't listen on a socket \"%s\": %m\n", filename); + err("can't listen on a socket \"%s\"", filename); goto err; } @@ -99,7 +99,7 @@ int main(int argc, char ** argv) pid = test_fork(); if (pid < 0) { - err("can't fork: %m\n"); + err("can't fork"); exit(1); } @@ -133,7 +133,7 @@ int main(int argc, char ** argv) sock = acc_sock; if (unlink(filename)) { - err("can't unlink %s: %m\n", filename); + err("can't unlink %s", filename); goto out_kill; } diff --git a/test/zdtm/live/static/env00.c b/test/zdtm/live/static/env00.c index c6ab23afd..afca275fa 100644 --- a/test/zdtm/live/static/env00.c +++ b/test/zdtm/live/static/env00.c @@ -17,7 +17,7 @@ int main(int argc, char **argv) test_init(argc, argv); if (setenv(envname, test_author, 1)) { - err("Can't set env var \"%s\" to \"%s\": %m\n", envname, test_author); + err("Can't set env var \"%s\" to \"%s\"", envname, test_author); exit(1); } diff --git a/test/zdtm/live/static/fanotify00.c b/test/zdtm/live/static/fanotify00.c index 0f3006a44..80bd0a23d 100644 --- a/test/zdtm/live/static/fanotify00.c +++ b/test/zdtm/live/static/fanotify00.c @@ -188,7 +188,7 @@ int parse_fanotify_fdinfo(int fd, struct fanotify_obj *obj, unsigned int expecte } if (expected_to_meet != met) { - err("Expected to meet %d entries but got %d\n", + err("Expected to meet %d entries but got %d", expected_to_meet, met); return -1; } @@ -196,7 +196,7 @@ int parse_fanotify_fdinfo(int fd, struct fanotify_obj *obj, unsigned int expecte return 0; parse_err: - err("Can't parse '%s'\n", str); + err("Can't parse '%s'", str); return -1; } @@ -224,27 +224,27 @@ int main (int argc, char *argv[]) FAN_CLASS_NOTIF | FAN_UNLIMITED_QUEUE, 0); if (fa_fd < 0) { - err("fanotify_init failed\n"); + err("fanotify_init failed"); exit(1); } del_after = open(fanotify_path, O_CREAT | O_TRUNC); if (del_after < 0) { - err("open failed\n"); + err("open failed"); exit(1); } if (fanotify_mark(fa_fd, FAN_MARK_ADD, FAN_MODIFY | FAN_ACCESS | FAN_OPEN | FAN_CLOSE, AT_FDCWD, fanotify_path)) { - err("fanotify_mark failed\n"); + err("fanotify_mark failed"); exit(1); } if (fanotify_mark(fa_fd, FAN_MARK_ADD | FAN_MARK_MOUNT, FAN_ONDIR | FAN_OPEN | FAN_CLOSE, AT_FDCWD, "/tmp")) { - err("fanotify_mark failed\n"); + err("fanotify_mark failed"); exit(1); } @@ -252,12 +252,12 @@ int main (int argc, char *argv[]) FAN_MARK_IGNORED_MASK | FAN_MARK_IGNORED_SURV_MODIFY, FAN_MODIFY | FAN_ACCESS, AT_FDCWD, "/tmp")) { - err("fanotify_mark failed\n"); + err("fanotify_mark failed"); exit(1); } if (parse_fanotify_fdinfo(fa_fd, &old, 3)) { - err("parsing fanotify fdinfo failed\n"); + err("parsing fanotify fdinfo failed"); exit(1); } @@ -298,7 +298,7 @@ int main (int argc, char *argv[]) if (fanotify_mark(fa_fd, FAN_MARK_REMOVE | FAN_MARK_MOUNT, FAN_ONDIR | FAN_OPEN | FAN_CLOSE, AT_FDCWD, "/tmp")) { - err("fanotify_mark failed\n"); + err("fanotify_mark failed"); exit(1); } diff --git a/test/zdtm/live/static/fdt_shared.c b/test/zdtm/live/static/fdt_shared.c index ee195c2f2..ea4ca8d14 100644 --- a/test/zdtm/live/static/fdt_shared.c +++ b/test/zdtm/live/static/fdt_shared.c @@ -54,7 +54,7 @@ static pid_t clone_child(int (*fn)(void *), int flags) pid = clone(fn, stack + STACK_SIZE, flags | SIGCHLD, NULL); if (pid == -1) { - err("Unable to clone a new process\n"); + err("Unable to clone a new process"); return -1; } @@ -69,7 +69,7 @@ static int child2(void *_arg) test_waitsig(); if (read(TEST_FD, buf, sizeof(TEST_STRING)) != sizeof(TEST_STRING)) { - err("Unable to read from %d\n", TEST_FD); + err("Unable to read from %d", TEST_FD); return 1; } @@ -123,12 +123,12 @@ static int child(void *_arg) } if (read(TEST_FD, buf, sizeof(TEST_STRING)) != sizeof(TEST_STRING)) { - err("Unable to read from %d\n", TEST_FD); + err("Unable to read from %d", TEST_FD); return 1; } if (close(TEST_FD) == -1) { - err("Unable to close(%d)\n", TEST_FD); + err("Unable to close(%d)", TEST_FD); return 1; } @@ -163,19 +163,19 @@ int main(int argc, char ** argv) fd = open(filename, O_RDWR | O_CREAT, 0666); if (fd == -1) { - err("Can't open /dev/zero\n"); + err("Can't open /dev/zero"); return -1; } for (i = 0; i < 3; i++) if (write(fd, TEST_STRING, sizeof(TEST_STRING)) != sizeof(TEST_STRING)) { - err("Unable to write a test string\n"); + err("Unable to write a test string"); return -1; } fd = dup2(fd, TEST_FD); if (fd == -1) { - err("Can't dup fd to %d\n", fd, TEST_FD); + err("Can't dup fd to %d", fd, TEST_FD); return -1; } diff --git a/test/zdtm/live/static/fifo-ghost.c b/test/zdtm/live/static/fifo-ghost.c index 93fcf4fb3..13d5ee13f 100644 --- a/test/zdtm/live/static/fifo-ghost.c +++ b/test/zdtm/live/static/fifo-ghost.c @@ -25,19 +25,19 @@ int main(int argc, char **argv) test_init(argc, argv); if (mknod(filename, mode, 0)) { - err("can't make fifo \"%s\": %m\n", filename); + err("can't make fifo \"%s\"", filename); exit(1); } fd = open(filename, O_RDWR); if (fd < 0) { - err("can't open %s: %m\n", filename); + err("can't open %s", filename); return 1; } fd_ro = open(filename, O_RDONLY); if (fd_ro < 0) { - err("can't open %s: %m\n", filename); + err("can't open %s", filename); return 1; } @@ -45,12 +45,12 @@ int main(int argc, char **argv) datagen(buf, sizeof(buf), &crc); ret = write(fd, buf, sizeof(buf)); if (ret != sizeof(buf)) { - err("write() failed\n"); + err("write() failed"); return 1; } if (unlink(filename) < 0) { - fail("can't unlink %s: %m", filename); + fail("can't unlink %s", filename); return 1; } @@ -61,18 +61,18 @@ int main(int argc, char **argv) ret = read(fd_ro, buf, sizeof(buf)); if (ret != sizeof(buf)) { - err("read() failed\n"); + err("read() failed"); return 1; } crc = ~0; if (datachk(buf, sizeof(buf), &crc)) { - fail("data corrupted\n"); + fail("data corrupted"); return 1; } if (close(fd_ro) < 0) { - fail("can't close %s: %m", filename); + fail("can't close %s", filename); return 1; } diff --git a/test/zdtm/live/static/fifo-rowo-pair.c b/test/zdtm/live/static/fifo-rowo-pair.c index ee27d5717..f0f14bbe3 100644 --- a/test/zdtm/live/static/fifo-rowo-pair.c +++ b/test/zdtm/live/static/fifo-rowo-pair.c @@ -44,18 +44,18 @@ int main(int argc, char **argv) test_init(argc, argv); if (mknod(name_master, S_IFIFO | 0700, 0)) { - err("can't make fifo \"%s\": %m\n", name_master); + err("can't make fifo \"%s\"", name_master); exit(1); } if (mknod(name_slave, S_IFIFO | 0700, 0)) { - err("can't make fifo \"%s\": %m\n", name_slave); + err("can't make fifo \"%s\"", name_slave); exit(1); } fd_slave = open(name_slave, O_RDWR); if (fd_slave < 0) { - err("can't open %s: %m\n", name_slave); + err("can't open %s", name_slave); exit(1); } @@ -67,13 +67,13 @@ int main(int argc, char **argv) fd_master = open(name_master, O_WRONLY); if (fd_master < 0) { - err("can't open %s: %m\n", name_master); + err("can't open %s", name_master); exit_shot_parent(1); } new_slave = dup2(fd_slave, 64); if (new_slave < 0) { - err("can't dup %s: %m\n", name_slave); + err("can't dup %s", name_slave); exit_shot_parent(1); } @@ -83,13 +83,13 @@ int main(int argc, char **argv) v = TEST_VALUE; if (write(new_slave, &v, sizeof(v)) != sizeof(v)) { - err("write failed: %m\n"); + err("write failed"); exit_shot_parent(1); } v = TEST_VALUE; if (write(fd_master, &v, sizeof(v)) != sizeof(v)) { - err("write failed: %m\n"); + err("write failed"); exit_shot_parent(1); } @@ -98,13 +98,13 @@ int main(int argc, char **argv) exit(0); } else if (pid < 0) { - err("test_fork failed: %m\n"); + err("test_fork failed"); exit(1); } fd_master = open(name_master, O_RDONLY); if (fd_master < 0) { - err("can't open %s: %m\n", name_master); + err("can't open %s", name_master); exit_shot(pid, 1); } @@ -115,7 +115,7 @@ int main(int argc, char **argv) test_waitsig(); if (read(fd_master, &v, sizeof(v)) != sizeof(v)) { - err("read failed: %m\n"); + err("read failed"); exit_shot(pid, 1); } @@ -127,7 +127,7 @@ int main(int argc, char **argv) } if (read(fd_slave, &v, sizeof(v)) != sizeof(v)) { - err("read failed: %m\n"); + err("read failed"); exit_shot(pid, 1); } if (v != TEST_VALUE) { @@ -144,7 +144,7 @@ int main(int argc, char **argv) err("can't unlink %s: %m", name_slave); if (!WIFEXITED(status)) { - err("child %d is still running\n", pid); + err("child %d is still running", pid); exit_shot(pid, 1); } diff --git a/test/zdtm/live/static/fifo.c b/test/zdtm/live/static/fifo.c index 1a55dfc5f..10c422191 100644 --- a/test/zdtm/live/static/fifo.c +++ b/test/zdtm/live/static/fifo.c @@ -28,13 +28,13 @@ int main(int argc, char **argv) test_init(argc, argv); if (mknod(filename, mode, 0)) { - err("can't make fifo \"%s\": %m\n", filename); + err("can't make fifo \"%s\"", filename); exit(1); } fd = open(filename, O_RDWR); if (fd < 0) { - err("can't open %s: %m\n", filename); + err("can't open %s", filename); return 1; } @@ -42,7 +42,7 @@ int main(int argc, char **argv) datagen(buf, BUF_SIZE, &crc); ret = write(fd, buf, BUF_SIZE); if (ret != BUF_SIZE) { - err("write() failed\n"); + err("write() failed"); return 1; } @@ -51,7 +51,7 @@ int main(int argc, char **argv) ret = read(fd, buf, BUF_SIZE); if (ret != BUF_SIZE) { - err("read() failed\n"); + err("read() failed"); return 1; } diff --git a/test/zdtm/live/static/fifo_ro.c b/test/zdtm/live/static/fifo_ro.c index edb66b596..1c83b0529 100644 --- a/test/zdtm/live/static/fifo_ro.c +++ b/test/zdtm/live/static/fifo_ro.c @@ -28,19 +28,19 @@ int main(int argc, char **argv) test_init(argc, argv); if (mknod(filename, mode, 0)) { - err("can't make fifo \"%s\": %m\n", filename); + err("can't make fifo \"%s\"", filename); exit(1); } fd = open(filename, O_RDWR); if (fd < 0) { - err("can't open %s: %m\n", filename); + err("can't open %s", filename); return 1; } fd_ro = open(filename, O_RDONLY); if (fd_ro < 0) { - err("can't open %s: %m\n", filename); + err("can't open %s", filename); return 1; } @@ -48,7 +48,7 @@ int main(int argc, char **argv) datagen(buf, BUF_SIZE, &crc); ret = write(fd, buf, BUF_SIZE); if (ret != BUF_SIZE) { - err("write() failed\n"); + err("write() failed"); return 1; } @@ -59,7 +59,7 @@ int main(int argc, char **argv) ret = read(fd_ro, buf, BUF_SIZE); if (ret != BUF_SIZE) { - err("read() failed\n"); + err("read() failed"); return 1; } diff --git a/test/zdtm/live/static/fifo_wronly.c b/test/zdtm/live/static/fifo_wronly.c index ec88dcf8c..12556a761 100644 --- a/test/zdtm/live/static/fifo_wronly.c +++ b/test/zdtm/live/static/fifo_wronly.c @@ -27,7 +27,7 @@ int main(int argc, char **argv) test_init(argc, argv); if (mknod(filename, mode, 0)) { - err("can't make fifo \"%s\": %m\n", filename); + err("can't make fifo \"%s\"", filename); exit(1); } @@ -42,13 +42,13 @@ int main(int argc, char **argv) int res; fd1 = open(filename, O_RDONLY); if (fd1 < 0) { - err("open(%s, O_RDONLY) Failed: %m\n", filename); + err("open(%s, O_RDONLY) Failed", filename); chret = errno; return chret; } res = read(fd1, rbuf, 7); if (res < 0) { - err("read error %s: %m\n", filename); + err("read error %s", filename); chret = errno; return chret; } @@ -66,7 +66,7 @@ int main(int argc, char **argv) fd = open(filename, O_WRONLY); if (fd < 0) { - err("open(%s, O_WRONLY) Failed: %m\n", filename); + err("open(%s, O_WRONLY) Failed", filename); kill(pid, SIGKILL); wait(NULL); return 1; @@ -76,7 +76,7 @@ int main(int argc, char **argv) test_waitsig(); if (write(fd, "string", 7) == -1) { - err("write(%d, 'string', 7) Failed: %m\n", fd); + err("write(%d, 'string', 7) Failed", fd); return 1; } diff --git a/test/zdtm/live/static/file_attr.c b/test/zdtm/live/static/file_attr.c index 52605ce18..45dd150af 100644 --- a/test/zdtm/live/static/file_attr.c +++ b/test/zdtm/live/static/file_attr.c @@ -38,7 +38,7 @@ int main(int argc, char ** argv) fd = open(filename, O_RDWR | O_CREAT | O_TRUNC, 0644); if (fd < 0) { - err("can't open %s: %m\n", filename); + err("can't open %s", filename); exit(1); } @@ -54,17 +54,17 @@ int main(int argc, char ** argv) .modtime = mtime, }; if (utime(filename, &ut)) { - err("can't set modtime %d on %s: %m\n", mtime, filename); + err("can't set modtime %d on %s", mtime, filename); exit(1); } if (fchmod(fd, perms)) { - err("can't set perms %o on %s: %m\n", perms, filename); + err("can't set perms %o on %s", perms, filename); exit(1); } if (unlink(filename)) { - err("can't unlink %s: %m\n", filename); + err("can't unlink %s", filename); exit(1); } diff --git a/test/zdtm/live/static/file_fown.c b/test/zdtm/live/static/file_fown.c index d6fd31638..4dbc9efb1 100644 --- a/test/zdtm/live/static/file_fown.c +++ b/test/zdtm/live/static/file_fown.c @@ -97,7 +97,7 @@ int main(int argc, char *argv[]) } if (pipe(pipes)) { - err("Can't create pipe: %m\n"); + err("Can't create pipe"); exit(1); } diff --git a/test/zdtm/live/static/file_locks00.c b/test/zdtm/live/static/file_locks00.c index 9c559a8bb..77ae11821 100644 --- a/test/zdtm/live/static/file_locks00.c +++ b/test/zdtm/live/static/file_locks00.c @@ -52,7 +52,7 @@ static int check_read_lock(int fd, int whence, off_t offset, off_t len) ret = fcntl(fd, F_GETLK, &lock); if (ret == -1) { - err("F_GETLK failed.\n"); + err("F_GETLK failed."); return -1; } @@ -80,7 +80,7 @@ static int check_write_lock(int fd, int whence, off_t offset, off_t len) ret = fcntl(fd, F_GETLK, &lock); if (ret == -1) { - err("F_GETLK failed.\n"); + err("F_GETLK failed."); return -1; } @@ -152,7 +152,7 @@ int main(int argc, char **argv) pid = fork(); if (pid < 0) { - err("Can't fork: %m\n"); + err("Can't fork"); return -1; } diff --git a/test/zdtm/live/static/file_locks01.c b/test/zdtm/live/static/file_locks01.c index 6944a473c..be905ffe3 100644 --- a/test/zdtm/live/static/file_locks01.c +++ b/test/zdtm/live/static/file_locks01.c @@ -107,7 +107,7 @@ static int check_file_locks() &fl_owner, &maj, &min, &i_no, &start, end); if (num < 10) { - err("Invalid lock info.\n"); + err("Invalid lock info."); break; } diff --git a/test/zdtm/live/static/file_locks02.c b/test/zdtm/live/static/file_locks02.c index 25ac1c653..48e4bd338 100644 --- a/test/zdtm/live/static/file_locks02.c +++ b/test/zdtm/live/static/file_locks02.c @@ -40,7 +40,7 @@ static int check_file_locks(pid_t child) fl_flag, fl_type, fl_option, &fl_owner); if (num < 4) { - err("Invalid lock info.\n"); + err("Invalid lock info."); break; } diff --git a/test/zdtm/live/static/file_locks03.c b/test/zdtm/live/static/file_locks03.c index e27abfaca..91669742c 100644 --- a/test/zdtm/live/static/file_locks03.c +++ b/test/zdtm/live/static/file_locks03.c @@ -40,7 +40,7 @@ static int check_file_locks(int alt_pid) fl_flag, fl_type, fl_option, &fl_owner); if (num < 4) { - err("Invalid lock info.\n"); + err("Invalid lock info."); break; } diff --git a/test/zdtm/live/static/file_locks04.c b/test/zdtm/live/static/file_locks04.c index 440532f61..f625e9bd5 100644 --- a/test/zdtm/live/static/file_locks04.c +++ b/test/zdtm/live/static/file_locks04.c @@ -40,7 +40,7 @@ static int check_file_locks(int alt_pid, int fd) fl_flag, fl_type, fl_option, &fl_owner); if (num < 4) { - err("Invalid lock info.\n"); + err("Invalid lock info."); break; } diff --git a/test/zdtm/live/static/futex.c b/test/zdtm/live/static/futex.c index 1e4f94f41..8a5e040c8 100644 --- a/test/zdtm/live/static/futex.c +++ b/test/zdtm/live/static/futex.c @@ -38,7 +38,7 @@ int main(int argc, char **argv) test_init(argc, argv); if (num_threads > MAX_NUM_THREADS) { - err("%d threads it too much. max is %d\n", + err("%d threads it too much. max is %d", num_threads, MAX_NUM_THREADS); goto out; } @@ -48,7 +48,7 @@ int main(int argc, char **argv) for (i = 0; i < num_threads; i++) if (pthread_create(&thr[i], NULL, thread_fn, &m)) { - err("Can't create %d'th thread\n", i + 1); + err("Can't create %d'th thread", i + 1); goto out_kill; } @@ -69,7 +69,7 @@ int main(int argc, char **argv) if (errno == EBUSY) fail("kids left my mutex locked\n"); else - err("kids spoiled my mutex\n"); + err("kids spoiled my mutex"); } if (kid_passed != num_threads) diff --git a/test/zdtm/live/static/get_smaps_bits.c b/test/zdtm/live/static/get_smaps_bits.c index a478d0295..e7f736a1a 100644 --- a/test/zdtm/live/static/get_smaps_bits.c +++ b/test/zdtm/live/static/get_smaps_bits.c @@ -119,7 +119,7 @@ int get_smaps_bits(unsigned long where, unsigned long *flags, unsigned long *mad fclose(smaps); if (!found) { - err("VmFlags not found for %lx\n", where); + err("VmFlags not found for %lx", where); return -1; } diff --git a/test/zdtm/live/static/inotify00.c b/test/zdtm/live/static/inotify00.c index 9ca27baf2..825404893 100644 --- a/test/zdtm/live/static/inotify00.c +++ b/test/zdtm/live/static/inotify00.c @@ -202,7 +202,7 @@ int main (int argc, char *argv[]) #ifndef INOTIFY01 if (unlink(test_file_path)) { - err("can't unlink %s\n", test_file_path); + err("can't unlink %s", test_file_path); exit(1); } diff --git a/test/zdtm/live/static/ipc_namespace.c b/test/zdtm/live/static/ipc_namespace.c index b51988a8a..9a74e6b78 100644 --- a/test/zdtm/live/static/ipc_namespace.c +++ b/test/zdtm/live/static/ipc_namespace.c @@ -71,12 +71,12 @@ static int read_ipc_sysctl(char *name, int *data, size_t size) fd = open(name, O_RDONLY); if (fd < 0) { - err("Can't open %d\n", name); + err("Can't open %d", name); return fd; } ret = read(fd, buf, 32); if (ret < 0) { - err("Can't read %s\n", name); + err("Can't read %s", name); ret = -errno; goto err; } @@ -94,7 +94,7 @@ static int get_messages_info(struct ipc_ns *ipc) ret = msgctl(0, MSG_INFO, (struct msqid_ds *)&info); if (ret < 0) { - err("msgctl failed with %d\n", errno); + err("msgctl failed with %d", errno); return ret; } @@ -118,7 +118,7 @@ static int get_semaphores_info(struct ipc_ns *ipc) err = semctl(0, 0, SEM_INFO, &info); if (err < 0) - err("semctl failed with %d\n", errno); + err("semctl failed with %d", errno); ipc->sem_ctls[0] = info.semmsl; ipc->sem_ctls[1] = info.semmns; @@ -141,7 +141,7 @@ static int get_shared_memory_info(struct ipc_ns *ipc) ret = shmctl(0, IPC_INFO, &u.shmid); if (ret < 0) - err("semctl failed with %d\n", errno); + err("semctl failed with %d", errno); ipc->shm_ctlmax = u.shminfo64.shmmax; ipc->shm_ctlall = u.shminfo64.shmall; @@ -149,7 +149,7 @@ static int get_shared_memory_info(struct ipc_ns *ipc) ret = shmctl(0, SHM_INFO, &u.shmid); if (ret < 0) - err("semctl failed with %d\n", errno); + err("semctl failed with %d", errno); ipc->shm_tot = u.shminfo.shm_tot; ipc->ids[IPC_SHM_IDS].in_use = u.shminfo.used_ids; @@ -177,19 +177,19 @@ int fill_ipc_ns(struct ipc_ns *ipc) ret = get_messages_info(ipc); if (ret < 0) { - err("Failed to collect messages\n"); + err("Failed to collect messages"); return ret; } ret = get_semaphores_info(ipc); if (ret < 0) { - err("Failed to collect semaphores\n"); + err("Failed to collect semaphores"); return ret; } ret = get_shared_memory_info(ipc); if (ret < 0) { - err("Failed to collect shared memory\n"); + err("Failed to collect shared memory"); return ret; } return 0; @@ -203,13 +203,13 @@ static int rand_ipc_sysctl(char *name, unsigned int val) fd = open(name, O_WRONLY); if (fd < 0) { - err("Can't open %d\n", name); + err("Can't open %d", name); return fd; } sprintf(buf, "%d\n", val); ret = write(fd, buf, strlen(buf)); if (ret < 0) { - err("Can't write %u into %s\n", val, name); + err("Can't write %u into %s", val, name); return -errno; } close(fd); @@ -232,7 +232,7 @@ static int rand_ipc_sem(void) (unsigned)lrand48(), (unsigned)lrand48()); ret = write(fd, buf, 128); if (ret < 0) { - err("Can't write %s: %d\n", name, errno); + err("Can't write %s: %d", name, errno); return -errno; } close(fd); @@ -270,7 +270,7 @@ static int rand_ipc_ns(void) ret = rand_ipc_sysctl("/proc/sys/fs/mqueue/msgsize_max", ((unsigned)lrand48() & (8192 * 128 - 1)) | 128); if (ret < 0) - err("Failed to randomize ipc namespace tunables\n"); + err("Failed to randomize ipc namespace tunables"); return ret; } @@ -281,49 +281,49 @@ static void show_ipc_entry(struct ipc_ns *old, struct ipc_ns *new) for (i = 0; i < 3; i++) { if (old->ids[i].in_use != new->ids[i].in_use) - err("ids[%d].in_use differs: %d ---> %d\n", i, + err("ids[%d].in_use differs: %d ---> %d", i, old->ids[i].in_use, new->ids[i].in_use); } for (i = 0; i < 4; i++) { if (old->sem_ctls[i] != new->sem_ctls[i]) - err("sem_ctls[%d] differs: %d ---> %d\n", i, + err("sem_ctls[%d] differs: %d ---> %d", i, old->sem_ctls[i], new->sem_ctls[i]); } if (old->msg_ctlmax != new->msg_ctlmax) - err("msg_ctlmax differs: %d ---> %d\n", + err("msg_ctlmax differs: %d ---> %d", old->msg_ctlmax, new->msg_ctlmax); if (old->msg_ctlmnb != new->msg_ctlmnb) - err("msg_ctlmnb differs: %d ---> %d\n", + err("msg_ctlmnb differs: %d ---> %d", old->msg_ctlmnb, new->msg_ctlmnb); if (old->msg_ctlmni != new->msg_ctlmni) - err("msg_ctlmni differs: %d ---> %d\n", + err("msg_ctlmni differs: %d ---> %d", old->msg_ctlmni, new->msg_ctlmni); if (old->auto_msgmni != new->auto_msgmni) - err("auto_msgmni differs: %d ---> %d\n", + err("auto_msgmni differs: %d ---> %d", old->auto_msgmni, new->auto_msgmni); if (old->shm_ctlmax != new->shm_ctlmax) - err("shm_ctlmax differs: %d ---> %d\n", + err("shm_ctlmax differs: %d ---> %d", old->shm_ctlmax, new->shm_ctlmax); if (old->shm_ctlall != new->shm_ctlall) - err("shm_ctlall differs: %d ---> %d\n", + err("shm_ctlall differs: %d ---> %d", old->shm_ctlall, new->shm_ctlall); if (old->shm_ctlmni != new->shm_ctlmni) - err("shm_ctlmni differs: %d ---> %d\n", + err("shm_ctlmni differs: %d ---> %d", old->shm_ctlmni, new->shm_ctlmni); if (old->shm_rmid_forced != new->shm_rmid_forced) - err("shm_rmid_forced differs: %d ---> %d\n", + err("shm_rmid_forced differs: %d ---> %d", old->shm_rmid_forced, new->shm_rmid_forced); if (old->mq_queues_max != new->mq_queues_max) - err("mq_queues_max differs: %d ---> %d\n", + err("mq_queues_max differs: %d ---> %d", old->mq_queues_max, new->mq_queues_max); if (old->mq_msg_max != new->mq_msg_max) - err("mq_msg_max differs: %d ---> %d\n", + err("mq_msg_max differs: %d ---> %d", old->mq_msg_max, new->mq_msg_max); if (old->mq_msgsize_max != new->mq_msgsize_max) - err("mq_msgsize_max differs: %d ---> %d\n", + err("mq_msgsize_max differs: %d ---> %d", old->mq_msgsize_max, new->mq_msgsize_max); } @@ -333,13 +333,13 @@ static int test_fn(int argc, char **argv) ret = rand_ipc_ns(); if (ret) { - err("Failed to randomize ipc ns before migration\n"); + err("Failed to randomize ipc ns before migration"); return -1; } ret = fill_ipc_ns(&ipc_before); if (ret) { - err("Failed to collect ipc ns before migration\n"); + err("Failed to collect ipc ns before migration"); return ret; } @@ -348,12 +348,12 @@ static int test_fn(int argc, char **argv) ret = fill_ipc_ns(&ipc_after); if (ret) { - err("Failed to collect ipc ns after migration\n"); + err("Failed to collect ipc ns after migration"); return ret; } if (memcmp(&ipc_before, &ipc_after, sizeof(ipc_after))) { - err("IPC's differ\n"); + err("IPC's differ"); show_ipc_entry(&ipc_before, &ipc_after); return -EINVAL; } diff --git a/test/zdtm/live/static/maps00.c b/test/zdtm/live/static/maps00.c index 175a86785..685b349fe 100644 --- a/test/zdtm/live/static/maps00.c +++ b/test/zdtm/live/static/maps00.c @@ -77,27 +77,27 @@ static int make_map(struct map *map) /* need file */ if (snprintf(map->filename, sizeof(map->filename), "%s-%02d", filename, i++) >= sizeof(map->filename)) { - err("filename %s is too long\n", filename); + err("filename %s is too long", filename); return -1; } map->fd = open(map->filename, O_RDWR | O_CREAT, 0600); if (map->fd < 0) { - err("can't open %s: %m\n", map->filename); + err("can't open %s", map->filename); return -1; } crc = ~0; datagen(buf, sizeof(buf), &crc); if (write(map->fd, buf, sizeof(buf)) != sizeof(buf)) { - err("failed to write %s: %m\n", map->filename); + err("failed to write %s", map->filename); return -1; } } map->ptr = mmap(NULL, ONE_MAP_SIZE, map->prot, map->flag, map->fd, 0); if (map->ptr == MAP_FAILED) { - err("can't create mapping: %m\n"); + err("can't create mapping"); return -1; } @@ -178,7 +178,7 @@ static int check_map(struct map *map) if (!(map->flag & MAP_ANONYMOUS)) { lseek(map->fd,0,SEEK_SET); if (write(map->fd,test_func,check_map - test_func)filename); + err("failed to write %s", map->filename); return -1; } } diff --git a/test/zdtm/live/static/maps02.c b/test/zdtm/live/static/maps02.c index 9473d94ca..55fae70f4 100644 --- a/test/zdtm/live/static/maps02.c +++ b/test/zdtm/live/static/maps02.c @@ -87,7 +87,7 @@ int main(int argc, char **argv) return -1; if (m[i].orig_flags != m[i].new_flags) { - err("Flags are changed %lx %lx -> %lx (%d)\n", + err("Flags are changed %lx %lx -> %lx (%d)", (unsigned long)m[i].start, m[i].orig_flags, m[i].new_flags, i); fail(); @@ -95,7 +95,7 @@ int main(int argc, char **argv) } if (m[i].orig_madv != m[i].new_madv) { - err("Madvs are changed %lx %lx -> %lx (%d)\n", + err("Madvs are changed %lx %lx -> %lx (%d)", (unsigned long)m[i].start, m[i].orig_madv, m[i].new_madv, i); fail(); diff --git a/test/zdtm/live/static/mountpoints.c b/test/zdtm/live/static/mountpoints.c index 6aa97514d..2b5c8a0ba 100644 --- a/test/zdtm/live/static/mountpoints.c +++ b/test/zdtm/live/static/mountpoints.c @@ -159,12 +159,12 @@ done: mkdir(MPTS_ROOT"/dev/overmount", 0600); fd = open(MPTS_ROOT"/dev/overmount/test.over", O_WRONLY | O_CREAT); if (fd == -1) { - err("Unable to open "MPTS_ROOT"/dev/overmount\n"); + err("Unable to open "MPTS_ROOT"/dev/overmount"); return -1; } close(fd); if (mount("none", MPTS_ROOT"/dev/overmount", "tmpfs", 0, "") < 0) { - err("Can't mount "MPTS_ROOT"/dev/overmount\n"); + err("Can't mount "MPTS_ROOT"/dev/overmount"); return 1; } @@ -309,7 +309,7 @@ done: } if (umount(MPTS_ROOT"/dev/overmount") == -1) { - err("Can't umount "MPTS_ROOT"/dev/overmount\n"); + err("Can't umount "MPTS_ROOT"/dev/overmount"); return -1; } if (access(MPTS_ROOT"/dev/overmount/test.over", F_OK)) { diff --git a/test/zdtm/live/static/mtime_mmap.c b/test/zdtm/live/static/mtime_mmap.c index 57e38c324..29413a4f4 100644 --- a/test/zdtm/live/static/mtime_mmap.c +++ b/test/zdtm/live/static/mtime_mmap.c @@ -34,7 +34,7 @@ int main(int argc, char **argv) fd = open(filename, O_RDWR | O_CREAT, 0666); if (fd < 0) { - err("can't open %s: %m\n", filename); + err("can't open %s", filename); exit(1); } @@ -42,12 +42,12 @@ int main(int argc, char **argv) count = sizeof(buf); memset(buf, 1, count); if (write(fd, buf, sizeof(buf)) != sizeof(buf)) { - err("failed to write %s: %m\n", filename); + err("failed to write %s", filename); exit(1); } if (fstat(fd, &fst) < 0) { - err("can't get %s file info: %m\n", filename); + err("can't get %s file info", filename); goto failed; } @@ -71,7 +71,7 @@ int main(int argc, char **argv) } if (fstat(fd, &fst) < 0) { - err("can't get %s file info: %m\n", filename); + err("can't get %s file info", filename); goto failed; } @@ -96,7 +96,7 @@ int main(int argc, char **argv) test_waitsig(); if (fstat(fd, &fst) < 0) { - err("can't get %s file info: %m\n", filename); + err("can't get %s file info", filename); goto failed; } diff --git a/test/zdtm/live/static/overmount_dev.c b/test/zdtm/live/static/overmount_dev.c index aa4ed1355..c99b6a53c 100644 --- a/test/zdtm/live/static/overmount_dev.c +++ b/test/zdtm/live/static/overmount_dev.c @@ -32,18 +32,18 @@ int main(int argc, char **argv) } if (mkdir(dirname, 0700)) { - err("can't make directory %s: %m\n", dirname); + err("can't make directory %s", dirname); exit(1); } if (mknod(path, mode, dev)) { - err("can't make device file \"%s\": %m\n", path); + err("can't make device file \"%s\"", path); exit(1); } fd = open(path, O_RDWR); if (fd < 0) { - err("can't open %s: %m\n", path); + err("can't open %s", path); goto rmdir; } diff --git a/test/zdtm/live/static/overmount_fifo.c b/test/zdtm/live/static/overmount_fifo.c index ad76a5418..a9fd6c487 100644 --- a/test/zdtm/live/static/overmount_fifo.c +++ b/test/zdtm/live/static/overmount_fifo.c @@ -30,18 +30,18 @@ int main(int argc, char **argv) } if (mkdir(dirname, 0700)) { - err("can't make directory %s: %m\n", dirname); + err("can't make directory %s", dirname); exit(1); } if (mknod(path, mode, 0)) { - err("can't make fifo \"%s\": %m\n", path); + err("can't make fifo \"%s\"", path); exit(1); } fd = open(path, O_RDWR); if (fd < 0) { - err("can't open %s: %m\n", path); + err("can't open %s", path); goto rmdir; } diff --git a/test/zdtm/live/static/overmount_file.c b/test/zdtm/live/static/overmount_file.c index cb0d1db09..20ae2bd45 100644 --- a/test/zdtm/live/static/overmount_file.c +++ b/test/zdtm/live/static/overmount_file.c @@ -28,13 +28,13 @@ int main(int argc, char **argv) } if (mkdir(dirname, 0700)) { - err("can't make directory %s: %m\n", dirname); + err("can't make directory %s", dirname); exit(1); } fd = open(path, O_RDWR | O_CREAT | O_TRUNC, 0644); if (fd < 0) { - err("can't open %s: %m\n", path); + err("can't open %s", path); goto rmdir; } diff --git a/test/zdtm/live/static/overmount_sock.c b/test/zdtm/live/static/overmount_sock.c index 278d92b82..13a61404c 100644 --- a/test/zdtm/live/static/overmount_sock.c +++ b/test/zdtm/live/static/overmount_sock.c @@ -50,7 +50,7 @@ static int setup_srv_sock(const char *filename) } if (listen(sock, 1) < 0) { - err("can't listen on a socket \"%s\": %m\n", filename); + err("can't listen on a socket \"%s\"", filename); goto err; } @@ -97,7 +97,7 @@ int main(int argc, char ** argv) } if (mkdir(dirname, 0700)) { - err("can't make directory %s: %m\n", dirname); + err("can't make directory %s", dirname); exit(1); } @@ -107,7 +107,7 @@ int main(int argc, char ** argv) pid = fork(); if (pid < 0) { - err("can't fork: %m\n"); + err("can't fork"); goto out; } diff --git a/test/zdtm/live/static/pdeath_sig.c b/test/zdtm/live/static/pdeath_sig.c index 4f2292af3..09b3257f1 100644 --- a/test/zdtm/live/static/pdeath_sig.c +++ b/test/zdtm/live/static/pdeath_sig.c @@ -80,7 +80,7 @@ int main(int argc, char **argv) ret = -1; read(pr[0], &ret, sizeof(ret)); if (ret != 0) { - err("C start error\n"); + err("C start error"); goto out; } diff --git a/test/zdtm/live/static/posix_timers.c b/test/zdtm/live/static/posix_timers.c index a0bdc5426..1dca0d5a2 100644 --- a/test/zdtm/live/static/posix_timers.c +++ b/test/zdtm/live/static/posix_timers.c @@ -308,7 +308,7 @@ static int setup_timers(void) } if (sigprocmask(SIG_SETMASK, &mask, NULL) == -1) { - err("Failed to unlock signal\n"); + err("Failed to unlock signal"); return -errno; } @@ -319,12 +319,12 @@ static int setup_timers(void) for (i = 0; i < 10; i++) { ret = timer_create(CLOCK_REALTIME, NULL, &timeridt); if (ret < 0) { - err("Can't create temporary posix timer %lx\n", (long) timeridt); + err("Can't create temporary posix timer %lx", (long) timeridt); return -errno; } ret = timer_delete(timeridt); if (ret < 0) { - err("Can't remove temporaty posix timer %lx\n", (long) timeridt); + err("Can't remove temporaty posix timer %lx", (long) timeridt); return -errno; } } @@ -334,7 +334,7 @@ static int setup_timers(void) sigemptyset(&info->sa.sa_mask); if (sigaction(info->sig, &info->sa, NULL) == -1) { - err("Failed to set SIGALRM handler\n"); + err("Failed to set SIGALRM handler"); return -errno; } @@ -346,7 +346,7 @@ static int setup_timers(void) sev.sigev_value.sival_ptr = info; if (timer_create(info->clock, &sev, &info->timerid) == -1) { - err("Can't create timer\n"); + err("Can't create timer"); return -errno; } @@ -359,12 +359,12 @@ static int setup_timers(void) its.it_interval.tv_sec = its.it_interval.tv_nsec = 0; if (clock_gettime(info->clock, &info->start) == -1) { - err("Can't get %s start time\n", info->name); + err("Can't get %s start time", info->name); return -errno; } if (timer_settime(info->timerid, 0, &its, NULL) == -1) { - err("Can't set timer\n"); + err("Can't set timer"); return -errno; } info++; @@ -383,12 +383,12 @@ static int get_total_sleep_time(struct timespec *tv, char *type) struct timespec boottime; if (clock_gettime(CLOCK_BOOTTIME, &boottime) == -1) { - err("Can't get CLOCK_BOOTTIME %s time\n", type); + err("Can't get CLOCK_BOOTTIME %s time", type); return -errno; } if (clock_gettime(CLOCK_MONOTONIC_COARSE, &boottime_coarse) == -1) { - err("Can't get CLOCK_MONOTONIC_COARSE %s time\n", type); + err("Can't get CLOCK_MONOTONIC_COARSE %s time", type); return -errno; } diff --git a/test/zdtm/live/static/pthread01.c b/test/zdtm/live/static/pthread01.c index 814df1f2e..3389ea6e3 100644 --- a/test/zdtm/live/static/pthread01.c +++ b/test/zdtm/live/static/pthread01.c @@ -81,20 +81,20 @@ static void *ch_thread_2(void *arg) task_waiter_wait4(&t2, 2); if (memcmp(tls_data.rand_string, __tls_data, sizeof(tls_data.rand_string))) { - err("Failed to restore tls_data.rand_string in thread 2\n"); + err("Failed to restore tls_data.rand_string in thread 2"); results_map[2] = -1; } else results_map[2] = 1; if (memcmp(&tls_data.blk_sigset, &blk_sigset, sizeof(tls_data.blk_sigset))) { - err("Failed to restore tls_data.blk_sigset in thread 2\n"); + err("Failed to restore tls_data.blk_sigset in thread 2"); results_map[4] = -1; } else results_map[4] = 1; pthread_sigmask(SIG_SETMASK, NULL, &new); if (memcmp(&tls_data.blk_sigset, &new, sizeof(tls_data.blk_sigset))) { - err("Failed to restore blk_sigset in thread 2\n"); + err("Failed to restore blk_sigset in thread 2"); results_map[6] = -1; show_sigset(&tls_data.blk_sigset); @@ -128,13 +128,13 @@ static void *ch_thread_1(void *arg) task_waiter_wait4(&t1, 2); if (memcmp(tls_data.rand_string, __tls_data, sizeof(tls_data.rand_string))) { - err("Failed to restore tls_data.rand_string in thread 1\n"); + err("Failed to restore tls_data.rand_string in thread 1"); results_map[1] = -1; } else results_map[1] = 1; if (memcmp(&tls_data.blk_sigset, &blk_sigset, sizeof(tls_data.blk_sigset))) { - err("Failed to restore tls_data.blk_sigset in thread 1\n"); + err("Failed to restore tls_data.blk_sigset in thread 1"); results_map[3] = -1; } else results_map[3] = 1; @@ -142,7 +142,7 @@ static void *ch_thread_1(void *arg) sigemptyset(&new); pthread_sigmask(SIG_SETMASK, NULL, &new); if (memcmp(&tls_data.blk_sigset, &new, sizeof(tls_data.blk_sigset))) { - err("Failed to restore blk_sigset in thread 1\n"); + err("Failed to restore blk_sigset in thread 1"); results_map[5] = -1; show_sigset(&tls_data.blk_sigset); diff --git a/test/zdtm/live/static/ptrace_sig.c b/test/zdtm/live/static/ptrace_sig.c index 0058e46e4..edbb06cc1 100644 --- a/test/zdtm/live/static/ptrace_sig.c +++ b/test/zdtm/live/static/ptrace_sig.c @@ -44,13 +44,13 @@ int child(int fd) ret = sigaction(SIGUSR2, &act, &old_act); if (ret < 0) { - err("signal failed\n"); + err("signal failed"); return 1; } ret = ptrace(PTRACE_TRACEME, 0, 0, 0); if (ret < 0) { - err("ptrace failed\n"); + err("ptrace failed"); return 1; } ret = write(child_fd, &ret, sizeof(ret)); @@ -122,7 +122,7 @@ int main(int argc, char ** argv) test_msg("wait while child initialized"); ret = read(child_pipe[0], &status, sizeof(status)); if (ret != sizeof(status)) { - err("read from child process failed\n"); + err("read from child process failed"); return 1; } diff --git a/test/zdtm/live/static/pty02.c b/test/zdtm/live/static/pty02.c index 92e3561a6..1195ebb93 100644 --- a/test/zdtm/live/static/pty02.c +++ b/test/zdtm/live/static/pty02.c @@ -54,7 +54,7 @@ int main(int argc, char *argv[]) new_master = dup(master); if (new_master < 0) { - err("can't dup master\n"); + err("can't dup master"); exit_shot_parent(1); } @@ -71,7 +71,7 @@ int main(int argc, char *argv[]) close(new_master); exit(0); } else if (pid < 0) { - err("test_fork failed: %m\n"); + err("test_fork failed"); exit(1); } diff --git a/test/zdtm/live/static/rmdir_open.c b/test/zdtm/live/static/rmdir_open.c index 981729d40..86bf6309b 100644 --- a/test/zdtm/live/static/rmdir_open.c +++ b/test/zdtm/live/static/rmdir_open.c @@ -21,18 +21,18 @@ int main(int argc, char **argv) test_init(argc, argv); if (mkdir(dirname, 0700)) { - err("Can't make dir\n"); + err("Can't make dir"); goto out; } fd = open(dirname, O_DIRECTORY); if (fd < 0) { - err("Can't open dir\n"); + err("Can't open dir"); goto outr; } if (rmdir(dirname)) { - err("Can't remove dir\n"); + err("Can't remove dir"); goto outr; } diff --git a/test/zdtm/live/static/rtc.c b/test/zdtm/live/static/rtc.c index c1f65f408..86bd955ee 100644 --- a/test/zdtm/live/static/rtc.c +++ b/test/zdtm/live/static/rtc.c @@ -48,7 +48,7 @@ int main(int argc, char **argv) end.tv_usec += end.tv_sec * 1000000; delta = end.tv_usec - start.tv_usec; if (labs(delta - 1000000 / TEST_HZ ) > 100000) { - err("delta = %ld\n", delta); + err("delta = %ld", delta); fail--; if (fail == 0) return 1; diff --git a/test/zdtm/live/static/selfexe00.c b/test/zdtm/live/static/selfexe00.c index a03c0e9ff..2c1d39c77 100644 --- a/test/zdtm/live/static/selfexe00.c +++ b/test/zdtm/live/static/selfexe00.c @@ -32,7 +32,7 @@ int main(int argc, char *argv[]) test_msg("%s pid %d\n", argv[0], getpid()); ret = readlink("/proc/self/exe", path_before, sizeof(path_before) - 1); if (ret < 0) { - err("Can't read selflink\n"); + err("Can't read selflink"); fail(); exit(1); } @@ -44,7 +44,7 @@ int main(int argc, char *argv[]) ret = readlink("/proc/self/exe", path_after, sizeof(path_after) - 1); if (ret < 0) { - err("Can't read selflink\n"); + err("Can't read selflink"); fail(); exit(1); } diff --git a/test/zdtm/live/static/session01.c b/test/zdtm/live/static/session01.c index 2fe6aab7f..a8d8a3c77 100644 --- a/test/zdtm/live/static/session01.c +++ b/test/zdtm/live/static/session01.c @@ -132,7 +132,7 @@ static int child(const int c) continue; if (getpgid(getpid()) != testcases[i].master.pid) if (setpgid(getpid(), testcases[i].master.pid) < 0) { - err("setpgid() failed (%d) (%d)\n", c, i); + err("setpgid() failed (%d) (%d)", c, i); goto err; } diff --git a/test/zdtm/live/static/session02.c b/test/zdtm/live/static/session02.c index 0638b8749..89d8419f1 100644 --- a/test/zdtm/live/static/session02.c +++ b/test/zdtm/live/static/session02.c @@ -180,7 +180,7 @@ static int send_command(int id, enum commands op, int arg1, int arg2) if (op == TEST_FORK) { if (processes[arg1].pid) { - err("%d is busy\n", arg1); + err("%d is busy", arg1); return -1; } } diff --git a/test/zdtm/live/static/session03.c b/test/zdtm/live/static/session03.c index 0c761b383..872d2273a 100644 --- a/test/zdtm/live/static/session03.c +++ b/test/zdtm/live/static/session03.c @@ -269,7 +269,7 @@ int main(int argc, char ** argv) ret = sigaction(SIGCHLD, NULL, &act); if (ret < 0) { - err("sigaction() failed\n"); + err("sigaction() failed"); return -1; } @@ -280,7 +280,7 @@ int main(int argc, char ** argv) ret = sigaction(SIGCHLD, &act, NULL); if (ret < 0) { - err("sigaction() failed\n"); + err("sigaction() failed"); return -1; } diff --git a/test/zdtm/live/static/shm.c b/test/zdtm/live/static/shm.c index 003474a38..e26de4882 100644 --- a/test/zdtm/live/static/shm.c +++ b/test/zdtm/live/static/shm.c @@ -30,14 +30,14 @@ static int fill_shm_seg(int id, size_t size) mem = shmat(id, NULL, 0); if (mem == (void *)-1) { - err("Can't attach shm: %d\n", -errno); + err("Can't attach shm: %d", -errno); return -1; } datagen(mem, size, &crc); if (shmdt(mem) < 0) { - err("Can't detach shm: %d\n", -errno); + err("Can't detach shm: %d", -errno); return -1; } return 0; @@ -49,7 +49,7 @@ static int get_shm_seg(int key, size_t size, unsigned int flags) id = shmget(key, size, 0777 | flags); if (id == -1) { - err("Can't get shm: %d\n", -errno); + err("Can't get shm: %d", -errno); return -1; } return id; @@ -75,7 +75,7 @@ static int check_shm_id(int id, size_t size) mem = shmat(id, NULL, 0); if (mem == (void *)-1) { - err("Can't attach shm: %d\n", -errno); + err("Can't attach shm: %d", -errno); return -1; } crc = INIT_CRC; @@ -84,7 +84,7 @@ static int check_shm_id(int id, size_t size) return -1; } if (shmdt(mem) < 0) { - err("Can't detach shm: %d\n", -errno); + err("Can't detach shm: %d", -errno); return -1; } return 0; diff --git a/test/zdtm/live/static/sigpending.c b/test/zdtm/live/static/sigpending.c index 6a3395c14..3464d77e6 100644 --- a/test/zdtm/live/static/sigpending.c +++ b/test/zdtm/live/static/sigpending.c @@ -121,7 +121,7 @@ static void *thread_fn(void *args) sigaddset(&act.sa_mask, TESTSIG); sigaddset(&act.sa_mask, THREADSIG); if (sigaction(TESTSIG, &act, NULL)) { - err("sigaction() failed\n"); + err("sigaction() failed"); return NULL; } @@ -228,19 +228,19 @@ int main(int argc, char ** argv) sigemptyset(&act.sa_mask); if (sigaction(SIGCHLD, &act, NULL)) { - err("sigaction() failed\n"); + err("sigaction() failed"); return -1; } sigaddset(&act.sa_mask, TESTSIG); sigaddset(&act.sa_mask, THREADSIG); if (sigaction(TESTSIG, &act, NULL)) { - err("sigaction() failed\n"); + err("sigaction() failed"); return -1; } if (sigaction(THREADSIG, &act, NULL)) { - err("sigaction() failed\n"); + err("sigaction() failed"); return -1; } diff --git a/test/zdtm/live/static/sk-unix-unconn.c b/test/zdtm/live/static/sk-unix-unconn.c index 03c95db62..282c6fbb3 100644 --- a/test/zdtm/live/static/sk-unix-unconn.c +++ b/test/zdtm/live/static/sk-unix-unconn.c @@ -21,13 +21,13 @@ int main(int argc, char ** argv) sk = socket(AF_UNIX, SOCK_STREAM, 0); if (sk == -1) { - err("socket\n"); + err("socket"); return 1; } skc = socket(AF_UNIX, SOCK_STREAM, 0); if (skc == -1) { - err("socket\n"); + err("socket"); return 1; } diff --git a/test/zdtm/live/static/socket-tcp.c b/test/zdtm/live/static/socket-tcp.c index ca5939e42..d3d1074c8 100644 --- a/test/zdtm/live/static/socket-tcp.c +++ b/test/zdtm/live/static/socket-tcp.c @@ -75,7 +75,7 @@ int main(int argc, char **argv) close(pfd[1]); if (read(pfd[0], &port, sizeof(port)) != sizeof(port)) { - err("Can't read port\n"); + err("Can't read port"); return 1; } diff --git a/test/zdtm/live/static/unhashed_proc.c b/test/zdtm/live/static/unhashed_proc.c index c46e21e4b..0ba3ae822 100644 --- a/test/zdtm/live/static/unhashed_proc.c +++ b/test/zdtm/live/static/unhashed_proc.c @@ -21,7 +21,7 @@ int main(int argc, char ** argv) pid = fork(); if (pid < 0) { - err("Fork failed %m\n"); + err("Fork failed %m"); exit(1); } else if (!pid) { pause(); @@ -32,7 +32,7 @@ int main(int argc, char ** argv) if (chdir(cwd1) < 0) { kill(pid, SIGKILL); - err("Chdir failed %m\n"); + err("Chdir failed %m"); exit(1); } @@ -40,16 +40,16 @@ int main(int argc, char ** argv) waitpid(pid, NULL, 0); if (getcwd(cwd1, sizeof(cwd1))) { - err("successful getcwd: %s\n", cwd1); + err("successful getcwd: %s", cwd1); exit(1); } else if (errno != ENOENT) { - err("wrong errno: %m\n"); + err("wrong errno"); exit(1); } len = readlink("/proc/self/cwd", cwd1, sizeof(cwd1)); if (len < 0) { - err("can't read cwd symlink %m\n"); + err("can't read cwd symlink %m"); exit(1); } cwd1[len] = 0; diff --git a/test/zdtm/live/static/unlink_fifo.c b/test/zdtm/live/static/unlink_fifo.c index 1dbdf766d..2822ac9e4 100644 --- a/test/zdtm/live/static/unlink_fifo.c +++ b/test/zdtm/live/static/unlink_fifo.c @@ -22,13 +22,13 @@ int main(int argc, char **argv) test_init(argc, argv); if (mknod(filename, mode, 0)) { - err("can't make fifo \"%s\": %m\n", filename); + err("can't make fifo \"%s\"", filename); exit(1); } fd = open(filename, O_RDWR); if (fd < 0) { - err("can't open %s: %m\n", filename); + err("can't open %s", filename); return 1; } diff --git a/test/zdtm/live/static/unlink_fifo_wronly.c b/test/zdtm/live/static/unlink_fifo_wronly.c index 8f3ed7276..2d5c446d3 100644 --- a/test/zdtm/live/static/unlink_fifo_wronly.c +++ b/test/zdtm/live/static/unlink_fifo_wronly.c @@ -20,20 +20,20 @@ int main(int argc, char **argv) test_init(argc, argv); if (mknod(filename, mode, 0)) { - err("can't make fifo \"%s\": %m\n", filename); + err("can't make fifo \"%s\"", filename); exit(1); } fd = open(filename, O_RDONLY | O_NONBLOCK); if (fd < 0) { - err("open(%s, O_RDONLY | O_NONBLOCK) Failed: %m\n", + err("open(%s, O_RDONLY | O_NONBLOCK) Failed", filename); return 1; } fd1 = open(filename, O_WRONLY); if (fd1 < 0) { - err("open(%s, O_WRONLY) Failed: %m\n", filename); + err("open(%s, O_WRONLY) Failed", filename); return 1; } diff --git a/test/zdtm/live/static/unlink_fstat00.c b/test/zdtm/live/static/unlink_fstat00.c index fe75dbeae..0428b7f4b 100644 --- a/test/zdtm/live/static/unlink_fstat00.c +++ b/test/zdtm/live/static/unlink_fstat00.c @@ -28,29 +28,29 @@ int main(int argc, char ** argv) fd = open(filename, O_RDWR | O_CREAT | O_TRUNC, 0644); if (fd < 0) { - err("can't open %s: %m\n", filename); + err("can't open %s", filename); exit(1); } if (fstat(fd, &fst) < 0) { - err("can't get file info %s before: %m\n", filename); + err("can't get file info %s before", filename); goto failed; } if (unlink(filename) < 0) { - err("can't unlink %s: %m\n", filename); + err("can't unlink %s", filename); goto failed; } /* Change file size */ if (fst.st_size != 0) { - err("%s file size eq %d\n", fst.st_size); + err("%s file size eq %d", fst.st_size); goto failed; } crc = ~0; datagen(buf, sizeof(buf), &crc); if (write(fd, buf, sizeof(buf)) != sizeof(buf)) { - err("can't write %s: %m\n", filename); + err("can't write %s", filename); goto failed; } /* Change file mode */ @@ -60,7 +60,7 @@ int main(int argc, char ** argv) mode = (fst.st_mode ^ S_IXOTH); if (fchmod(fd, mode) < 0) { - err("can't chmod %s: %m\n", filename); + err("can't chmod %s", filename); goto failed; } @@ -70,7 +70,7 @@ int main(int argc, char ** argv) } else { /* Change uid, gid */ if (fchown(fd, (uid = fst.st_uid + 1), (gid = fst.st_gid + 1)) < 0) { - err("can't chown %s: %m\n", filename); + err("can't chown %s", filename); goto failed; } } @@ -84,7 +84,7 @@ int main(int argc, char ** argv) test_waitsig(); if (fstat(fd, &fst) < 0) { - err("can't get %s file info after: %m\n", filename); + err("can't get %s file info after", filename); goto failed; } diff --git a/test/zdtm/live/static/unlink_fstat01.c b/test/zdtm/live/static/unlink_fstat01.c index 73a9613a2..06c06b57a 100644 --- a/test/zdtm/live/static/unlink_fstat01.c +++ b/test/zdtm/live/static/unlink_fstat01.c @@ -24,28 +24,28 @@ int main(int argc, char ** argv) fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644); if (fd < 0) { - err("can't open %s: %m\n", filename); + err("can't open %s", filename); exit(1); } if (fstat(fd, &fst) < 0) { - err("can't get file info %s before: %m\n", filename); + err("can't get file info %s before", filename); goto failed; } if (fst.st_size != 0) { - err("%s file size eq %d\n", fst.st_size); + err("%s file size eq %d", fst.st_size); goto failed; } if (unlink(filename) < 0) { - err("can't unlink %s: %m\n", filename); + err("can't unlink %s", filename); goto failed; } memset(buf, '0', sizeof(buf)); if (write(fd, buf, sizeof(buf)) != sizeof(buf)) { - err("can't write %s: %m\n", filename); + err("can't write %s", filename); goto failed; } @@ -53,7 +53,7 @@ int main(int argc, char ** argv) test_waitsig(); if (fstat(fd, &fst) < 0) { - err("can't get %s file info after: %m\n", filename); + err("can't get %s file info after", filename); goto failed; } diff --git a/test/zdtm/live/static/unlink_fstat02.c b/test/zdtm/live/static/unlink_fstat02.c index d85192fe7..ae791aa1f 100644 --- a/test/zdtm/live/static/unlink_fstat02.c +++ b/test/zdtm/live/static/unlink_fstat02.c @@ -25,7 +25,7 @@ int main(int argc, char ** argv) fd[0] = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644); if (fd[0] < 0) { - err("can't open %s: %m\n", filename); + err("can't open %s", filename); exit(1); } @@ -37,33 +37,33 @@ int main(int argc, char ** argv) fd[1] = open(link_name, O_RDONLY); if (fd[1] < 0) { - err("can't open %s: %m\n", link_name); + err("can't open %s", link_name); goto failed0; } if (fstat(fd[0], &fst) < 0) { - err("can't get file info %s before: %m\n", filename); + err("can't get file info %s before", filename); goto failed; } if (fst.st_size != 0) { - err("%s file size eq %d\n", fst.st_size); + err("%s file size eq %d", fst.st_size); goto failed; } if (unlink(filename) < 0) { - err("can't unlink %s: %m\n", filename); + err("can't unlink %s", filename); goto failed; } if (unlink(link_name) < 0) { - err("can't unlink %s: %m\n", link_name); + err("can't unlink %s", link_name); goto failed; } memset(buf, '0', sizeof(buf)); if (write(fd[0], buf, sizeof(buf)) != sizeof(buf)) { - err("can't write %s: %m\n", filename); + err("can't write %s", filename); goto failed; } @@ -71,12 +71,12 @@ int main(int argc, char ** argv) test_waitsig(); if (fstat(fd[0], &fst) < 0) { - err("can't get %s file info after: %m\n", filename); + err("can't get %s file info after", filename); goto failed; } if (fstat(fd[1], &fst2) < 0) { - err("can't get %s file2 info after: %m\n", link_name); + err("can't get %s file2 info after", link_name); goto failed; } diff --git a/test/zdtm/live/static/unlink_fstat03.c b/test/zdtm/live/static/unlink_fstat03.c index 6bf4e1879..7a5ed2ecb 100644 --- a/test/zdtm/live/static/unlink_fstat03.c +++ b/test/zdtm/live/static/unlink_fstat03.c @@ -28,7 +28,7 @@ int main(int argc, char ** argv) fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644); if (fd < 0) { - err("can't open %s: %m\n", filename); + err("can't open %s", filename); exit(1); } @@ -39,23 +39,23 @@ int main(int argc, char ** argv) } if (fstat(fd, &fst) < 0) { - err("can't get file info %s before: %m\n", filename); + err("can't get file info %s before", filename); goto failed; } if (fst.st_size != 0) { - err("%s file size eq %d\n", fst.st_size); + err("%s file size eq %d", fst.st_size); goto failed; } if (unlink(filename) < 0) { - err("can't unlink %s: %m\n", filename); + err("can't unlink %s", filename); goto failed; } memset(buf, '0', sizeof(buf)); if (write(fd, buf, sizeof(buf)) != sizeof(buf)) { - err("can't write %s: %m\n", filename); + err("can't write %s", filename); goto failed; } @@ -63,12 +63,12 @@ int main(int argc, char ** argv) test_waitsig(); if (statfs(link_name, &fsst) < 0) { - err("statfs(%s): %m\n", link_name); + err("statfs(%s)", link_name); goto failed; } if (fstat(fd, &fst2) < 0) { - err("can't get %s file info after: %m\n", filename); + err("can't get %s file info after", filename); goto failed; } diff --git a/test/zdtm/live/static/unlink_largefile.c b/test/zdtm/live/static/unlink_largefile.c index 8407ecc29..5f0e35a6c 100644 --- a/test/zdtm/live/static/unlink_largefile.c +++ b/test/zdtm/live/static/unlink_largefile.c @@ -23,12 +23,12 @@ int main(int argc, char ** argv) fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_LARGEFILE, 0644); if (fd < 0) { - err("can't open %s: %m\n", filename); + err("can't open %s", filename); exit(1); } if (lseek64(fd, offset, SEEK_SET) < 0) { - err("can't lseek %s, offset= %x: %m\n", filename, + err("can't lseek %s, offset= %x", filename, offset); goto failed; } @@ -36,12 +36,12 @@ int main(int argc, char ** argv) count = sizeof(buf); memset(buf, 0, count); if (write(fd, buf, count) != count) { - err("can't write %s: %m\n", filename); + err("can't write %s", filename); goto failed; } if (unlink(filename) < 0) { - err("can't unlink %s: %m\n", filename); + err("can't unlink %s", filename); goto failed; } diff --git a/test/zdtm/live/static/uptime_grow.c b/test/zdtm/live/static/uptime_grow.c index e3d772c1a..0a93d400f 100644 --- a/test/zdtm/live/static/uptime_grow.c +++ b/test/zdtm/live/static/uptime_grow.c @@ -21,7 +21,7 @@ int main(int argc, char **argv) test_init(argc, argv); if (clock_gettime(CLOCK_MONOTONIC, &tm_old)) { - err("clock_gettime failed: %m\n"); + err("clock_gettime failed"); exit(1); } @@ -29,7 +29,7 @@ int main(int argc, char **argv) while (test_go()) { if (clock_gettime(CLOCK_MONOTONIC, &tm)) { - err("clock_gettime failed: %m\n"); + err("clock_gettime failed"); exit(1); } if (!tv_ge(&tm, &tm_old)) { diff --git a/test/zdtm/live/static/utsname.c b/test/zdtm/live/static/utsname.c index 934b6b47b..1037b8bc4 100644 --- a/test/zdtm/live/static/utsname.c +++ b/test/zdtm/live/static/utsname.c @@ -20,13 +20,13 @@ static int test_fn(int argc, char **argv) fd = open("/proc/sys/kernel/hostname", O_WRONLY); if (fd < 0) { - err("Can't open hostname\n"); + err("Can't open hostname"); return 1; } ret = write(fd, ZDTM_NODE, sizeof(ZDTM_NODE)); if (ret != sizeof(ZDTM_NODE)) { - err("Can't write nodename\n"); + err("Can't write nodename"); return 1; } @@ -34,13 +34,13 @@ static int test_fn(int argc, char **argv) fd = open("/proc/sys/kernel/domainname", O_WRONLY); if (fd < 0) { - err("Can't open domainname\n"); + err("Can't open domainname"); return -errno; } ret = write(fd, ZDTM_DOMAIN, sizeof(ZDTM_DOMAIN)); if (ret != sizeof(ZDTM_DOMAIN)) { - err("Can't write domainname\n"); + err("Can't write domainname"); return 1; } diff --git a/test/zdtm/live/static/vdso01.c b/test/zdtm/live/static/vdso01.c index dd5ee3aa9..9be9a60a6 100644 --- a/test/zdtm/live/static/vdso01.c +++ b/test/zdtm/live/static/vdso01.c @@ -135,7 +135,7 @@ static int vdso_fill_symtable(char *mem, size_t size, struct vdso_symtable *t) * Make sure it's a file we support. */ if (memcmp(ehdr->e_ident, elf_ident, sizeof(elf_ident))) { - err("Elf header magic mismatch\n"); + err("Elf header magic mismatch"); return -EINVAL; } @@ -149,14 +149,14 @@ static int vdso_fill_symtable(char *mem, size_t size, struct vdso_symtable *t) switch (phdr->p_type) { case PT_DYNAMIC: if (dynamic) { - err("Second PT_DYNAMIC header\n"); + err("Second PT_DYNAMIC header"); return -EINVAL; } dynamic = phdr; break; case PT_LOAD: if (load) { - err("Second PT_LOAD header\n"); + err("Second PT_LOAD header"); return -EINVAL; } load = phdr; @@ -165,7 +165,7 @@ static int vdso_fill_symtable(char *mem, size_t size, struct vdso_symtable *t) } if (!load || !dynamic) { - err("One of obligated program headers is missed\n"); + err("One of obligated program headers is missed"); return -EINVAL; } @@ -196,7 +196,7 @@ static int vdso_fill_symtable(char *mem, size_t size, struct vdso_symtable *t) } if (!dyn_strtab || !dyn_symtab || !dyn_strsz || !dyn_syment || !dyn_hash) { - err("Not all dynamic entries are present\n"); + err("Not all dynamic entries are present"); return -EINVAL; } @@ -248,7 +248,7 @@ static int vdso_fill_symtable(char *mem, size_t size, struct vdso_symtable *t) return 0; err_oob: - err("Corrupted Elf data\n"); + err("Corrupted Elf data"); return -EFAULT; } @@ -377,7 +377,7 @@ int main(int argc, char *argv[]) test_init(argc, argv); if (vdso_fill_self_symtable(&symtable)) { - err("Faied to parse vdso\n"); + err("Faied to parse vdso"); return -1; } diff --git a/test/zdtm/live/static/wait00.c b/test/zdtm/live/static/wait00.c index 5719992f9..984b9206f 100644 --- a/test/zdtm/live/static/wait00.c +++ b/test/zdtm/live/static/wait00.c @@ -20,7 +20,7 @@ int main(int argc, char ** argv) pid = fork(); if (pid < 0) { - err("fork failed: %m\n"); + err("fork failed"); exit(1); } diff --git a/test/zdtm/live/static/write_read00.c b/test/zdtm/live/static/write_read00.c index 3aba8ec10..fa48c2b16 100644 --- a/test/zdtm/live/static/write_read00.c +++ b/test/zdtm/live/static/write_read00.c @@ -21,14 +21,14 @@ int main(int argc, char ** argv) fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644); if (fd < 0) { - err("can't open %s: %m\n", filename); + err("can't open %s", filename); exit(1); } crc = ~0; datagen(buf, sizeof(buf), &crc); if (write(fd, buf, sizeof(buf)) != sizeof(buf)) { - err("can't write %s: %m\n", filename); + err("can't write %s", filename); exit(1); } diff --git a/test/zdtm/live/static/write_read01.c b/test/zdtm/live/static/write_read01.c index 71282717b..4d96b66f2 100644 --- a/test/zdtm/live/static/write_read01.c +++ b/test/zdtm/live/static/write_read01.c @@ -22,14 +22,14 @@ int main(int argc, char ** argv) fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644); if (fd < 0) { - err("can't open %s: %m\n", filename); + err("can't open %s", filename); exit(1); } crc = ~0; datagen(buf, sizeof(buf), &crc); if (write(fd, buf, sizeof(buf)) != sizeof(buf)) { - err("can't write %s: %m\n", filename); + err("can't write %s", filename); exit(1); } @@ -37,13 +37,13 @@ int main(int argc, char ** argv) fd = open(filename, O_RDONLY); if (fd < 0) { - err("can't open %s: %m\n", filename); + err("can't open %s", filename); exit(1); } len = sizeof(buf) / 2; if (read(fd, buf, len) != len) { - err("can't read %s: %m\n", filename); + err("can't read %s", filename); exit(1); } diff --git a/test/zdtm/live/static/write_read02.c b/test/zdtm/live/static/write_read02.c index e5a6a5283..0ac5580da 100644 --- a/test/zdtm/live/static/write_read02.c +++ b/test/zdtm/live/static/write_read02.c @@ -23,7 +23,7 @@ int main(int argc, char ** argv) fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644); if (fd < 0) { - err("can't open %s: %m\n", filename); + err("can't open %s", filename); exit(1); } @@ -35,14 +35,14 @@ int main(int argc, char ** argv) sprintf(str, "standard_%s", filename); fd1 = open(str, O_WRONLY | O_CREAT | O_TRUNC, 0644); if (write(fd1, buf, full_len) != full_len) { - err("can't write %s: %m\n", str); + err("can't write %s", str); exit(1); } close(fd1); len = sizeof(buf) / 2; if (write(fd, buf, len) != len) { - err("can't write %s: %m\n", filename); + err("can't write %s", filename); exit(1); } diff --git a/test/zdtm/live/static/write_read10.c b/test/zdtm/live/static/write_read10.c index fff758106..88a425644 100644 --- a/test/zdtm/live/static/write_read10.c +++ b/test/zdtm/live/static/write_read10.c @@ -27,24 +27,24 @@ int main(int argc, char ** argv) fd = open(filename, O_RDWR | O_CREAT | O_TRUNC, 0644); if (fd < 0) { - err("can't open %s: %m\n", filename); + err("can't open %s", filename); exit(1); } child_fd = open(filename, O_RDWR | O_CREAT | O_TRUNC, 0644); if (fd < 0) { - err("can't open %s: %m\n", filename); + err("can't open %s", filename); exit(1); } if (unlink(filename)) { - err("can't unlink %s: %m\n", filename); + err("can't unlink %s", filename); exit(1); } pid = fork(); if (pid < 0) { - err("can't fork: %m\n"); + err("can't fork"); exit(1); } diff --git a/test/zdtm/live/static/zombie00.c b/test/zdtm/live/static/zombie00.c index 358f9a873..eb5a9ef20 100644 --- a/test/zdtm/live/static/zombie00.c +++ b/test/zdtm/live/static/zombie00.c @@ -41,7 +41,7 @@ int main(int argc, char ** argv) for (i = 0; i < NR_ZOMBIES; i++) { zombie[i].pid = fork(); if (zombie[i].pid < 0) { - err("Fork failed %m\n"); + err("Fork failed %m"); exit(1); } diff --git a/test/zdtm/live/streaming/fifo_dyn.c b/test/zdtm/live/streaming/fifo_dyn.c index 4265f6497..9c77d8c82 100644 --- a/test/zdtm/live/streaming/fifo_dyn.c +++ b/test/zdtm/live/streaming/fifo_dyn.c @@ -37,18 +37,18 @@ int main(int argc, char **argv) for (i = 0; i < PROCS_DEF; i++) { file_path = path[i]; if (snprintf(file_path, BUF_SIZE, "%s-%02d", filename, i) >= BUF_SIZE) { - err("filename %s is too long\n", filename); + err("filename %s is too long", filename); exit(1); } if (mkfifo(file_path, mode)) { - err("can't make fifo \"%s\": %m\n", file_path); + err("can't make fifo \"%s\"", file_path); exit(1); } } pid = test_fork(); if (pid < 0) { - err("Can't fork: %m\n"); + err("Can't fork"); kill(0, SIGKILL); exit(1); } @@ -56,14 +56,14 @@ int main(int argc, char **argv) file_path = path[0]; readfd = open(file_path, O_RDONLY); if (readfd < 0) { - err("open(%s, O_RDONLY) Failed: %m\n", file_path); + err("open(%s, O_RDONLY) Failed", file_path); ret = errno; return ret; } file_path = path[1]; writefd = open(file_path, O_WRONLY); if (writefd < 0) { - err("open(%s, O_WRONLY) Failed: %m\n", file_path); + err("open(%s, O_WRONLY) Failed", file_path); ret = errno; return ret; } @@ -80,7 +80,7 @@ int main(int argc, char **argv) file_path = path[0]; writefd = open(file_path, O_WRONLY); if (writefd < 0) { - err("open(%s, O_WRONLY) Failed: %m\n", file_path); + err("open(%s, O_WRONLY) Failed", file_path); kill(pid, SIGKILL); return 1; } @@ -88,7 +88,7 @@ int main(int argc, char **argv) file_path = path[1]; readfd = open(file_path, O_RDONLY); if (readfd < 0) { - err("open(%s, O_RDONLY) Failed: %m\n", file_path); + err("open(%s, O_RDONLY) Failed", file_path); kill(pid, SIGKILL); return 1; }