diff options
Diffstat (limited to 'runtime/staprun')
-rw-r--r-- | runtime/staprun/common.c | 9 | ||||
-rw-r--r-- | runtime/staprun/mainloop.c | 2 | ||||
-rw-r--r-- | runtime/staprun/staprun.c | 7 |
3 files changed, 14 insertions, 4 deletions
diff --git a/runtime/staprun/common.c b/runtime/staprun/common.c index dca45e4d..fd16b4b8 100644 --- a/runtime/staprun/common.c +++ b/runtime/staprun/common.c @@ -14,6 +14,8 @@ #include <sys/types.h> #include <unistd.h> #include <sys/utsname.h> +#include <assert.h> + /* variables needed by parse_args() */ int verbose; @@ -323,11 +325,11 @@ err: * @len: length of the data to be sent * * Returns 0 on success, negative otherwise. - * XXX: no, it doesn't ... it should return @len on success. */ int send_request(int type, void *data, int len) { char buf[1024]; + int rc = 0; /* Before doing memcpy, make sure 'buf' is big enough. */ if ((len + 4) > (int)sizeof(buf)) { @@ -337,5 +339,8 @@ int send_request(int type, void *data, int len) memcpy(buf, &type, 4); memcpy(&buf[4], data, len); - return write(control_channel, buf, len + 4); + assert (control_channel >= 0); + rc = write (control_channel, buf, len + 4); + if (rc < 0) return rc; + return (rc != len+4); } diff --git a/runtime/staprun/mainloop.c b/runtime/staprun/mainloop.c index 42037473..a7b919cb 100644 --- a/runtime/staprun/mainloop.c +++ b/runtime/staprun/mainloop.c @@ -1,6 +1,6 @@ /* -*- linux-c -*- * - * mainloop - staprun main loop + * mainloop - stapio main loop * * This file is part of systemtap, and is free software. You can * redistribute it and/or modify it under the terms of the GNU General diff --git a/runtime/staprun/staprun.c b/runtime/staprun/staprun.c index daebe705..6eb6d8b5 100644 --- a/runtime/staprun/staprun.c +++ b/runtime/staprun/staprun.c @@ -385,8 +385,13 @@ void send_relocation_modules () int send_relocations () { - int rc = send_relocation_kernel (); + int rc; + rc = init_ctl_channel (modname, 0); + if (rc < 0) goto out; + rc = send_relocation_kernel (); send_relocation_modules (); + close_ctl_channel (); + out: return rc; } |