]> granicus.if.org Git - strace/commitdiff
util.c: make "Out of memory" messages a bit more informative
authorEugene Syromyatnikov <evgsyr@gmail.com>
Mon, 9 Apr 2018 08:19:01 +0000 (10:19 +0200)
committerDmitry V. Levin <ldv@altlinux.org>
Tue, 24 Apr 2018 00:35:27 +0000 (00:35 +0000)
Since these are emitted in multiple places and are not expected during
any normal operation, it makes sense to report the caller name.

* util.c (print_quoted_string_ex, print_quoted_string_ex, dumpiov_upto,
dumpstr): Replace error_msg with error_func_msg.

util.c

diff --git a/util.c b/util.c
index 468904d7d767a0cca2602ee2b0b2a25976ca9b4d..89856ae8344112335c44e130d6b82ec66c7ff07a 100644 (file)
--- a/util.c
+++ b/util.c
@@ -693,7 +693,7 @@ print_quoted_string_ex(const char *str, unsigned int size,
 
        alloc_size = 4 * size;
        if (alloc_size / 4 != size) {
-               error_msg("Out of memory");
+               error_func_msg("Out of memory");
                tprints("???");
                return -1;
        }
@@ -706,7 +706,7 @@ print_quoted_string_ex(const char *str, unsigned int size,
        } else {
                outstr = buf = malloc(alloc_size);
                if (!buf) {
-                       error_msg("Out of memory");
+                       error_func_msg("Out of memory");
                        tprints("???");
                        return -1;
                }
@@ -888,7 +888,7 @@ dumpiov_upto(struct tcb *const tcp, const int len, const kernel_ulong_t addr,
        /* Assuming no sane program has millions of iovs */
        if ((unsigned)len > 1024*1024 /* insane or negative size? */
            || (iov = malloc(size)) == NULL) {
-               error_msg("Out of memory");
+               error_func_msg("Out of memory");
                return;
        }
        if (umoven(tcp, addr, size, iov) >= 0) {
@@ -935,7 +935,7 @@ dumpstr(struct tcb *const tcp, const kernel_ulong_t addr, const int len)
                str = malloc(len + 16);
                if (!str) {
                        strsize = -1;
-                       error_msg("Out of memory");
+                       error_func_msg("Out of memory");
                        return;
                }
                strsize = len + 16;