Unexport die_out_of_memory
Print more specific error diagnostics than a generic "Out of memory" when an error happens outside xmalloc.c. * defs.h (die_out_of_memory): Remove prototype. * strace.c (strace_popen, init): Call perror_msg_and_die instead of die_out_of_memory. * unwind.c (unwind_tcb_init): Likewise. * xmalloc.c (die_out_of_memory): Add static qualifier.
This commit is contained in:
parent
11621507fb
commit
2698d1d060
1
defs.h
1
defs.h
@ -393,7 +393,6 @@ void error_msg_and_help(const char *fmt, ...)
|
||||
ATTRIBUTE_FORMAT((printf, 1, 2)) ATTRIBUTE_NORETURN;
|
||||
void perror_msg_and_die(const char *fmt, ...)
|
||||
ATTRIBUTE_FORMAT((printf, 1, 2)) ATTRIBUTE_NORETURN;
|
||||
void die_out_of_memory(void) ATTRIBUTE_NORETURN;
|
||||
|
||||
void *xmalloc(size_t size) ATTRIBUTE_MALLOC ATTRIBUTE_ALLOC_SIZE((1));
|
||||
void *xcalloc(size_t nmemb, size_t size)
|
||||
|
4
strace.c
4
strace.c
@ -566,7 +566,7 @@ strace_popen(const char *command)
|
||||
swap_uid();
|
||||
fp = fdopen(fds[1], "w");
|
||||
if (!fp)
|
||||
die_out_of_memory();
|
||||
perror_msg_and_die("fdopen");
|
||||
return fp;
|
||||
}
|
||||
|
||||
@ -1750,7 +1750,7 @@ init(int argc, char *argv[])
|
||||
#endif
|
||||
case 'E':
|
||||
if (putenv(optarg) < 0)
|
||||
die_out_of_memory();
|
||||
perror_msg_and_die("putenv");
|
||||
break;
|
||||
case 'I':
|
||||
opt_intr = string_to_uint_upto(optarg, NUM_INTR_OPTS - 1);
|
||||
|
2
unwind.c
2
unwind.c
@ -113,7 +113,7 @@ unwind_tcb_init(struct tcb *tcp)
|
||||
|
||||
tcp->libunwind_ui = _UPT_create(tcp->pid);
|
||||
if (!tcp->libunwind_ui)
|
||||
die_out_of_memory();
|
||||
perror_msg_and_die("_UPT_create");
|
||||
|
||||
tcp->queue = xmalloc(sizeof(*tcp->queue));
|
||||
tcp->queue->head = NULL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user