* Return command's exit status or -1 on error. */
| 35 | * Return command's exit status or -1 on error. |
| 36 | */ |
| 37 | static int run_command(const char *command) |
| 38 | { |
| 39 | int status; |
| 40 | |
| 41 | status = system(command); |
| 42 | if (status >= 0 && WIFEXITED(status)) |
| 43 | return WEXITSTATUS(status); |
| 44 | |
| 45 | if (status < 0) { |
| 46 | char error_buf[80]; |
| 47 | char* errp = ceph_strerror_r(errno, error_buf, sizeof(error_buf)); |
| 48 | fprintf(stderr, "couldn't run '%s': %s\n", command, |
| 49 | errp); |
| 50 | } else if (WIFSIGNALED(status)) { |
| 51 | fprintf(stderr, "'%s' killed by signal %d\n", command, |
| 52 | WTERMSIG(status)); |
| 53 | } else { |
| 54 | fprintf(stderr, "weird status from '%s': %d\n", command, |
| 55 | status); |
| 56 | } |
| 57 | |
| 58 | return -1; |
| 59 | } |
| 60 | |
| 61 | int module_has_param(const char *module, const char *param) |
| 62 | { |