]> granicus.if.org Git - strace/commitdiff
2005-05-31 Dmitry V. Levin <ldv@altlinux.org>
authorRoland McGrath <roland@redhat.com>
Wed, 1 Jun 2005 18:55:42 +0000 (18:55 +0000)
committerRoland McGrath <roland@redhat.com>
Wed, 1 Jun 2005 18:55:42 +0000 (18:55 +0000)
* bjm.c (sys_query_module) [LINUX]: Unitize "out of memory"
errors reporting style.
* strace.c (rebuild_pollv) [USE_PROCFS]: Likewise.
* system.c (sys_capget, sys_capset) [SYS_capget]: Likewise.
* util.c (printstr): Likewise.
(dumpiov) [HAVE_SYS_UIO_H]: Likewise.
(fixvfork) [SUNOS4]: Likewise.
* desc.c (decode_select): Continue to decode syscall arguments
in case of OOM condition.
* file.c (sys_getdents): Likewise.
(sys_getdents64) [_LFS64_LARGEFILE]: Likewise.
(sys_getdirentries) [FREEBSD]: Likewise.
* mem.c (sys_mincore): Changed type of variables which deal with
malloc size from int to unsigned long.
Fixes RH#159308.

bjm.c
desc.c
file.c
mem.c
strace.c
system.c
util.c

diff --git a/bjm.c b/bjm.c
index 2bd0279b6748ecba32b28e0c409e72e715b56e57..301ac40c07334a4ee4278f4b76faba9d893b6ea0 100644 (file)
--- a/bjm.c
+++ b/bjm.c
@@ -136,7 +136,7 @@ struct tcb *tcp;
                                size_t  idx;
 
                                if (data==NULL) {
-                                       fprintf(stderr, "sys_query_module: No memory\n");
+                                       fprintf(stderr, "out of memory\n");
                                        tprintf(" /* %Zu entries */ ", ret);
                                } else {
                                        umoven(tcp, tcp->u_arg[2], tcp->u_arg[3], data);
@@ -161,7 +161,7 @@ struct tcb *tcp;
                                size_t                  idx;
 
                                if (data==NULL) {
-                                       fprintf(stderr, "sys_query_module: No memory\n");
+                                       fprintf(stderr, "out of memory\n");
                                        tprintf(" /* %Zu entries */ ", ret);
                                } else {
                                        umoven(tcp, tcp->u_arg[2], tcp->u_arg[3], data);
diff --git a/desc.c b/desc.c
index 031d5a134c1384dbb7553dfc2e43099f390480a5..6e864b2734f10c87a0158a5ad4ca99f0f1a8b30a 100644 (file)
--- a/desc.c
+++ b/desc.c
@@ -424,10 +424,8 @@ int bitness;
 
        if (entering(tcp)) {
                fds = (fd_set *) malloc(fdsize);
-               if (fds == NULL) {
-                       tprintf("out of memory\n");
-                       return 0;
-               }
+               if (fds == NULL)
+                       fprintf(stderr, "out of memory\n");
                nfds = args[0];
                tprintf("%d", nfds);
                for (i = 0; i < 3; i++) {
@@ -436,7 +434,7 @@ int bitness;
                                tprintf(", NULL");
                                continue;
                        }
-                       if (!verbose(tcp)) {
+                       if (fds == NULL || !verbose(tcp)) {
                                tprintf(", %#lx", arg);
                                continue;
                        }
@@ -485,10 +483,8 @@ int bitness;
                }
 
                fds = (fd_set *) malloc(fdsize);
-               if (fds == NULL) {
-                       tprintf("out of memory\n");
-                       return 0;
-               }
+               if (fds == NULL)
+                       fprintf(stderr, "out of memory\n");
 
                outstr[0] = '\0';
                for (i = 0; i < 3; i++) {
@@ -497,7 +493,8 @@ int bitness;
 
                        tcp->auxstr = outstr;
                        arg = args[i+1];
-                       if (!arg || umoven(tcp, arg, fdsize, (char *) fds) < 0)
+                       if (fds == NULL || !arg ||
+                           umoven(tcp, arg, fdsize, (char *) fds) < 0)
                                continue;
                        for (j = 0; j < args[0]; j++) {
                                if (FD_ISSET(j, fds)) {
diff --git a/file.c b/file.c
index 485d95f5eaf3d27a2a15bc87fb671abf665184e5..8a3432f3403a921922e291801d660c3682b72e6a 100644 (file)
--- a/file.c
+++ b/file.c
@@ -2042,11 +2042,12 @@ struct tcb *tcp;
        }
        len = tcp->u_rval;
        if ((buf = malloc(len)) == NULL) {
-               tprintf("out of memory\n");
+               tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
+               fprintf(stderr, "out of memory\n");
                return 0;
        }
        if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
-               tprintf("{...}, %lu", tcp->u_arg[2]);
+               tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
                free(buf);
                return 0;
        }
@@ -2125,11 +2126,12 @@ struct tcb *tcp;
        }
        len = tcp->u_rval;
        if ((buf = malloc(len)) == NULL) {
-               tprintf("out of memory\n");
+               tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
+               fprintf(stderr, "out of memory\n");
                return 0;
        }
        if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
-               tprintf("{...}, %lu", tcp->u_arg[2]);
+               tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
                free(buf);
                return 0;
        }
@@ -2193,11 +2195,12 @@ struct tcb * tcp;
        }
        len = tcp->u_rval;
        if ((buf = malloc(len)) == NULL) {
-               tprintf("out of memory\n");
+               tprintf("%#lx, %lu, %#lx", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
+               fprintf(stderr, "out of memory\n");
                return 0;
        }
        if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
-               tprintf("{...}, %lu, %#lx", tcp->u_arg[2], tcp->u_arg[3]);
+               tprintf("%#lx, %lu, %#lx", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
                free(buf);
                return 0;
        }
diff --git a/mem.c b/mem.c
index 7404ef2337b1aaf971cdee1cf6be22d91d74852b..fbc26daf7985aa367d7156f3692e9471c51dc245 100644 (file)
--- a/mem.c
+++ b/mem.c
@@ -504,7 +504,7 @@ int
 sys_mincore(tcp)
 struct tcb *tcp;
 {
-       int i, len;
+       unsigned long i, len;
        char *vec = NULL;
 
        if (entering(tcp)) {
@@ -512,7 +512,7 @@ struct tcb *tcp;
        } else {
                len = tcp->u_arg[1];
                if (syserror(tcp) || tcp->u_arg[2] == 0 ||
-                       (vec = malloc((u_int)len)) == NULL ||
+                       (vec = malloc(len)) == NULL ||
                        umoven(tcp, tcp->u_arg[2], len, vec) < 0)
                        tprintf("%#lx", tcp->u_arg[2]);
                else {
index d13243d6143f0846d7ce6642a30ad3faa48001ff..12f1fc79aee16debce417a1236a3d65573da138f 100644 (file)
--- a/strace.c
+++ b/strace.c
@@ -1486,7 +1486,7 @@ rebuild_pollv()
                free (pollv);
        pollv = (struct pollfd *) malloc(nprocs * sizeof pollv[0]);
        if (pollv == NULL) {
-               fprintf(stderr, "strace: out of memory for poll vector\n");
+               fprintf(stderr, "%s: out of memory\n", progname);
                exit(1);
        }
 
index 82c5499a2dfcb53f2edae6d495a5509b81f1c8ef..623571cf4f7cf44cd4d398825de1651b6dd48dc8 100644 (file)
--- a/system.c
+++ b/system.c
@@ -1466,14 +1466,14 @@ struct tcb *tcp;
        if(!entering(tcp)) {
                if (!arg0) {
                        if ((arg0 = malloc(sizeof(*arg0))) == NULL) {
-                               fprintf(stderr, "sys_capget: no memory\n");
+                               fprintf(stderr, "out of memory\n");
                                tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]);
                                return -1;
                        }
                }
                if (!arg1) {
                        if ((arg1 = malloc(sizeof(*arg1))) == NULL) {
-                               fprintf(stderr, "sys_capget: no memory\n");
+                               fprintf(stderr, "out of memory\n");
                                tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]);
                                return -1;
                        }
@@ -1518,14 +1518,14 @@ struct tcb *tcp;
        if(entering(tcp)) {
                if (!arg0) {
                        if ((arg0 = malloc(sizeof(*arg0))) == NULL) {
-                               fprintf(stderr, "sys_capset: no memory\n");
+                               fprintf(stderr, "out of memory\n");
                                tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]);
                                return -1;
                        }
                }
                if (!arg1) {
                        if ((arg1 = malloc(sizeof(*arg1))) == NULL) {
-                               fprintf(stderr, "sys_capset: no memory\n");
+                               fprintf(stderr, "out of memory\n");
                                tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]);
                                return -1;
                        }
diff --git a/util.c b/util.c
index d445b0c4d8e1ffd31f2151fb15a811a189cbd775..f54f6fce2bc9b38544b0dc0ba1b44f974cab41da 100644 (file)
--- a/util.c
+++ b/util.c
@@ -415,7 +415,7 @@ int len;
        if (!str) {
                if ((str = malloc(max_strlen)) == NULL
                    || (outstr = malloc(2*max_strlen)) == NULL) {
-                       fprintf(stderr, "printstr: no memory\n");
+                       fprintf(stderr, "out of memory\n");
                        tprintf("%#lx", addr);
                        return;
                }
@@ -557,7 +557,7 @@ int len;
                if (str)
                        free(str);
                if ((str = malloc(len)) == NULL) {
-                       fprintf(stderr, "dump: no memory\n");
+                       fprintf(stderr, "out of memory\n");
                        return;
                }
                strsize = len;
@@ -2019,7 +2019,7 @@ struct tcb *tcp;
                return -1;
        }
        if ((strtab = malloc((unsigned)ld.ld_symb_size)) == NULL) {
-               fprintf(stderr, "fixvfork: out of memory\n");
+               fprintf(stderr, "out of memory\n");
                return -1;
        }
        if (umoven(tcp, (int)ld.ld_symbols+(int)N_TXTADDR(hdr),