diff options
author | hunt <hunt> | 2007-03-20 20:21:36 +0000 |
---|---|---|
committer | hunt <hunt> | 2007-03-20 20:21:36 +0000 |
commit | 6fa8d6e2a8378bfaee0e8e1af8cc707b4e14aab3 (patch) | |
tree | 72a9861b7d77b0cbfa87f1328892d78417e9ab82 /runtime/staprun/symbols.c | |
parent | a39e781f2dcd56e155b0612cb1e045bb485c5c23 (diff) | |
download | systemtap-steved-6fa8d6e2a8378bfaee0e8e1af8cc707b4e14aab3.tar.gz systemtap-steved-6fa8d6e2a8378bfaee0e8e1af8cc707b4e14aab3.tar.xz systemtap-steved-6fa8d6e2a8378bfaee0e8e1af8cc707b4e14aab3.zip |
2007-03-20 Martin Hunt <hunt@redhat.com>
* symbols.c (send_module): If send returns < 0 then
cleanup and exit.
(do_kernel_symbols): Ditto.
Diffstat (limited to 'runtime/staprun/symbols.c')
-rw-r--r-- | runtime/staprun/symbols.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/runtime/staprun/symbols.c b/runtime/staprun/symbols.c index ca18a8ca..c8758c37 100644 --- a/runtime/staprun/symbols.c +++ b/runtime/staprun/symbols.c @@ -128,8 +128,12 @@ void send_module (char *mname) { char data[32768]; int len = get_sections(mname, data, sizeof(data)); - if (len) - send_request(STP_MODULE, data, len); + if (len) { + if (send_request(STP_MODULE, data, len) < 0) { + err("Loading of module %s failed. Exiting...\n", mname); + cleanup_and_exit(0); + } + } } int do_module (void *data) @@ -221,20 +225,32 @@ void do_kernel_symbols(void) *(int *)buf = STP_SYMBOLS; *(int *)(buf+sizeof(long)) = num_syms; *(int *)(buf+sizeof(long)+sizeof(int)) = (unsigned)(dataptr - data); - send_data(buf, 2*sizeof(int)+sizeof(long)); + if (send_data(buf, 2*sizeof(int)+sizeof(long)) < 0) + goto err; /* send syms */ - send_data(sym_base, num_syms*sizeof(struct _stp_symbol)+sizeof(long)); + if (send_data(sym_base, num_syms*sizeof(struct _stp_symbol)+sizeof(long)) < 0) + goto err; /* send data */ - send_data(data_base, dataptr-data+sizeof(long)); + if (send_data(data_base, dataptr-data+sizeof(long)) < 0) + goto err; free(data_base); free(sym_base); fclose(kallsyms); if (dataptr >= datamax) { - fprintf(stderr,"Error: overflowed symbol data area.\n"); + err("Error: overflowed symbol data area.\n"); cleanup_and_exit(0); } + return; + +err: + free(data_base); + free(sym_base); + fclose(kallsyms); + + err("Loading of symbols failed. Exiting...\n"); + cleanup_and_exit(0); } |