summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>2005-06-01 18:55:42 +0000
committerRoland McGrath <roland@redhat.com>2005-06-01 18:55:42 +0000
commit46100d07257824da2ae1147da0324b5788c95501 (patch)
treeda94b95631e8e412eded4fac13b6a36e50b1e7dc
parente776e3e4cbf675f33d2661c58d2442d6d6be9566 (diff)
downloadstrace-46100d07257824da2ae1147da0324b5788c95501.tar.gz
strace-46100d07257824da2ae1147da0324b5788c95501.tar.bz2
strace-46100d07257824da2ae1147da0324b5788c95501.tar.xz
2005-05-31 Dmitry V. Levin <ldv@altlinux.org>
* 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.
-rw-r--r--bjm.c4
-rw-r--r--desc.c17
-rw-r--r--file.c15
-rw-r--r--mem.c4
-rw-r--r--strace.c2
-rw-r--r--system.c8
-rw-r--r--util.c6
7 files changed, 28 insertions, 28 deletions
diff --git a/bjm.c b/bjm.c
index 2bd0279..301ac40 100644
--- 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 031d5a1..6e864b2 100644
--- 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 485d95f..8a3432f 100644
--- 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 7404ef2..fbc26da 100644
--- 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 {
diff --git a/strace.c b/strace.c
index d13243d..12f1fc7 100644
--- 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);
}
diff --git a/system.c b/system.c
index 82c5499..623571c 100644
--- 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 d445b0c..f54f6fc 100644
--- 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),