diff options
author | Frediano Ziglio <fziglio@redhat.com> | 2018-12-22 08:37:14 +0000 |
---|---|---|
committer | Frediano Ziglio <fziglio@redhat.com> | 2018-12-23 17:04:01 +0000 |
commit | f7859820a12d9d8d4024004824942305d84e5500 (patch) | |
tree | 34e438cfae43488a4cceff4934e9d0d61fd9a2a4 /tools | |
parent | caefeececdba5bba3bcc5eae7d1b9a509f9a6d93 (diff) |
reds_stat: Use EXIT_SUCCESS/EXIT_FAILURE for program result
-1 is not much portable and standard.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Snir Sheriber <ssheribe@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/reds_stat.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tools/reds_stat.c b/tools/reds_stat.c index 3110afb4..deffec1b 100644 --- a/tools/reds_stat.c +++ b/tools/reds_stat.c @@ -88,7 +88,7 @@ int main(int argc, char **argv) size_t shm_size; size_t shm_old_size; int shm_name_len; - int ret = -1; + int ret = EXIT_FAILURE; int fd; struct stat st; unsigned header_size = sizeof(SpiceStat); @@ -102,18 +102,18 @@ int main(int argc, char **argv) if (argc > 2 || !kvm_pid) { fprintf(stderr, "usage: reds_stat [qemu_pid] (e.g. `pgrep qemu`)\n"); - return -1; + return ret; } shm_name_len = strlen(SPICE_STAT_SHM_NAME) + 64; if (!(shm_name = (char *)malloc(shm_name_len))) { perror("malloc"); - return -1; + return ret; } snprintf(shm_name, shm_name_len, SPICE_STAT_SHM_NAME, kvm_pid); if ((fd = shm_open(shm_name, O_RDONLY, 0444)) == -1) { perror("shm_open"); free(shm_name); - return -1; + return ret; } shm_size = sizeof(SpiceStat); reds_stat = (SpiceStat *)mmap(NULL, shm_size, PROT_READ, MAP_SHARED, fd, 0); @@ -160,7 +160,7 @@ int main(int argc, char **argv) print_stat_tree(reds_stat->root_index, 0); sleep(1); } - ret = 0; + ret = EXIT_SUCCESS; error: free(values); |