]> granicus.if.org Git - strace/commitdiff
Mass replace error_msg("%s", "literal") -> error_msg("literal")
authorDenys Vlasenko <vda.linux@googlemail.com>
Tue, 26 Feb 2013 11:30:09 +0000 (12:30 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Tue, 26 Feb 2013 11:30:09 +0000 (12:30 +0100)
There is no need to print literal strings through "%s".
Only untrusted strings such as filenames need that.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
signal.c
strace.c
syscall.c
util.c

index 227b1491573522b908bb7f912c575eb15bbfa285..8873c74431e69239f44d5f49788cf58f8ee12429 100644 (file)
--- a/signal.c
+++ b/signal.c
@@ -913,7 +913,7 @@ sys_sigreturn(struct tcb *tcp)
                sigset_t sigm;
                i1 = sparc_regs.u_regs[U_REG_O1];
                if (umove(tcp, i1, &si) < 0) {
-                       perror_msg("%s", "sigreturn: umove");
+                       perror_msg("sigreturn: umove");
                        return 0;
                }
                long_to_sigset(si.si_mask, &sigm);
@@ -942,7 +942,7 @@ sys_sigreturn(struct tcb *tcp)
                m_siginfo_t si;
                sigset_t sigm;
                if (ptrace(PTRACE_GETREGS, tcp->pid, (char *)&regs, 0) < 0) {
-                       perror_msg("%s", "sigreturn: PTRACE_GETREGS");
+                       perror_msg("sigreturn: PTRACE_GETREGS");
                        return 0;
                }
                sp = regs.regs[29];
@@ -957,7 +957,7 @@ sys_sigreturn(struct tcb *tcp)
                long regs[PT_MAX+1];
                sigset_t sigm;
                if (ptrace(PTRACE_GETREGS, tcp->pid, NULL, (long)regs) < 0) {
-                       perror_msg("%s", "sigreturn: PTRACE_GETREGS");
+                       perror_msg("sigreturn: PTRACE_GETREGS");
                        return 0;
                }
                if (umove(tcp, regs[PT_USP], &sc) < 0)
index de5b08a06c25ccb2d52f77fdf265d9973acb21d6..4975153540f20eefbd58cb9305fbfa0c43e277f4 100644 (file)
--- a/strace.c
+++ b/strace.c
@@ -750,15 +750,15 @@ detach(struct tcb *tcp)
                }
                else if (errno != ESRCH) {
                        /* Shouldn't happen. */
-                       perror_msg("%s", "detach: ptrace(PTRACE_DETACH, ...)");
+                       perror_msg("detach: ptrace(PTRACE_DETACH, ...)");
                }
                else if (my_tkill(tcp->pid, 0) < 0) {
                        if (errno != ESRCH)
-                               perror_msg("%s", "detach: checking sanity");
+                               perror_msg("detach: checking sanity");
                }
                else if (!sigstop_expected && my_tkill(tcp->pid, SIGSTOP) < 0) {
                        if (errno != ESRCH)
-                               perror_msg("%s", "detach: stopping child");
+                               perror_msg("detach: stopping child");
                }
                else
                        sigstop_expected = 1;
@@ -771,21 +771,21 @@ detach(struct tcb *tcp)
                                if (errno == ECHILD) /* Already gone.  */
                                        break;
                                if (errno != EINVAL) {
-                                       perror_msg("%s", "detach: waiting");
+                                       perror_msg("detach: waiting");
                                        break;
                                }
 #endif /* __WALL */
                                /* No __WALL here.  */
                                if (waitpid(tcp->pid, &status, 0) < 0) {
                                        if (errno != ECHILD) {
-                                               perror_msg("%s", "detach: waiting");
+                                               perror_msg("detach: waiting");
                                                break;
                                        }
 #ifdef __WCLONE
                                        /* If no processes, try clones.  */
                                        if (waitpid(tcp->pid, &status, __WCLONE) < 0) {
                                                if (errno != ECHILD)
-                                                       perror_msg("%s", "detach: waiting");
+                                                       perror_msg("detach: waiting");
                                                break;
                                        }
 #endif /* __WCLONE */
@@ -934,7 +934,7 @@ startup_attach(void)
                                }
                                ntid -= nerr;
                                if (ntid == 0) {
-                                       perror_msg("%s", "attach: ptrace(PTRACE_ATTACH, ...)");
+                                       perror_msg("attach: ptrace(PTRACE_ATTACH, ...)");
                                        droptcb(tcp);
                                        continue;
                                }
@@ -955,7 +955,7 @@ startup_attach(void)
                        } /* if (opendir worked) */
                } /* if (-f) */
                if (ptrace_attach_or_seize(tcp->pid) < 0) {
-                       perror_msg("%s", "attach: ptrace(PTRACE_ATTACH, ...)");
+                       perror_msg("attach: ptrace(PTRACE_ATTACH, ...)");
                        droptcb(tcp);
                        continue;
                }
index 120b19bb79500cf6a7e66c3c01e0490562236c04..5bf2a12fc4bb63bf7ba6afb0fe53ce786e127a24 100644 (file)
--- a/syscall.c
+++ b/syscall.c
@@ -1076,7 +1076,7 @@ get_scno(struct tcb *tcp)
                errno = 0;
                opcode = ptrace(PTRACE_PEEKTEXT, tcp->pid, (char *)(psw - sizeof(long)), 0);
                if (errno) {
-                       perror_msg("%s", "peektext(psw-oneword)");
+                       perror_msg("peektext(psw-oneword)");
                        return -1;
                }
 
diff --git a/util.c b/util.c
index 88798c0a1cfc484022bb312da1fb901e8faa5571..354efef6e330c47b641de23de1149d396bed9d7e 100644 (file)
--- a/util.c
+++ b/util.c
@@ -808,9 +808,9 @@ umoven(struct tcb *tcp, long addr, int len, char *laddr)
                        else if (errno != EINVAL && errno != ESRCH)
                                /* EINVAL or ESRCH could be seen if process is gone,
                                 * all the rest is strange and should be reported. */
-                               perror_msg("%s", "process_vm_readv");
+                               perror_msg("process_vm_readv");
                } else {
-                       perror_msg("process_vm_readv: short read (%d < %d)", r, len);
+                       error_msg("process_vm_readv: short read (%d < %d)", r, len);
                }
        }
 
@@ -923,7 +923,7 @@ umovestr(struct tcb *tcp, long addr, int len, char *laddr)
                                        /* EINVAL or ESRCH could be seen
                                         * if process is gone, all the rest
                                         * is strange and should be reported. */
-                                       perror_msg("%s", "process_vm_readv");
+                                       perror_msg("process_vm_readv");
                                goto vm_readv_didnt_work;
                        }
                        if (memchr(local[0].iov_base, '\0', r))