]> granicus.if.org Git - strace/commitdiff
Consistently print OOM diagnostic messages
authorDmitry V. Levin <ldv@altlinux.org>
Mon, 25 May 2015 20:33:31 +0000 (23:33 +0300)
committerDmitry V. Levin <ldv@altlinux.org>
Mon, 25 May 2015 22:25:22 +0000 (22:25 +0000)
* bjm.c (sys_query_module): Use error_msg to print OOM diagnostics.
* util.c (dumpiov, dumpstr): Likewise.

bjm.c
util.c

diff --git a/bjm.c b/bjm.c
index 435d6bbf2549f7b78629b35ab49cca77f07fa24a..31720530bc21d4dd2d131ae5aec18f4cd3d192c9 100644 (file)
--- a/bjm.c
+++ b/bjm.c
@@ -107,7 +107,7 @@ SYS_FUNC(query_module)
                                size_t  idx;
 
                                if (!data) {
-                                       fprintf(stderr, "out of memory\n");
+                                       error_msg("Out of memory");
                                        tprintf(" /* %lu entries */ ", (unsigned long)ret);
                                } else {
                                        if (umoven(tcp, tcp->u_arg[2],
@@ -134,7 +134,7 @@ SYS_FUNC(query_module)
                                size_t                  idx;
 
                                if (!data) {
-                                       fprintf(stderr, "out of memory\n");
+                                       error_msg("Out of memory");
                                        tprintf(" /* %lu entries */ ", (unsigned long)ret);
                                } else {
                                        if (umoven(tcp, tcp->u_arg[2],
diff --git a/util.c b/util.c
index 9dad3f1a6789daa1092e8092c5376c040325a7d6..63000b5708bbda1464dc19e82ab3f519d53b8bd1 100644 (file)
--- a/util.c
+++ b/util.c
@@ -828,7 +828,7 @@ dumpiov(struct tcb *tcp, int len, long addr)
        /* Assuming no sane program has millions of iovs */
        if ((unsigned)len > 1024*1024 /* insane or negative size? */
            || (iov = malloc(size)) == NULL) {
-               fprintf(stderr, "Out of memory\n");
+               error_msg("Out of memory");
                return;
        }
        if (umoven(tcp, addr, size, iov) >= 0) {
@@ -871,7 +871,7 @@ dumpstr(struct tcb *tcp, long addr, int len)
                str = malloc(len + 16);
                if (!str) {
                        strsize = -1;
-                       fprintf(stderr, "Out of memory\n");
+                       error_msg("Out of memory");
                        return;
                }
                strsize = len + 16;