Commit f59326ab authored by Kir Kolyshkin's avatar Kir Kolyshkin Committed by Pavel Emelyanov

criu: don't return negative values from main() 1/2

We should return 1 not -1, because -1 becomes 255.

>From man bash: "the shell may use values above
125 specially". Don't be a black sheep and return 1.

This is first part, patching obvious direct return statements.
Signed-off-by: 's avatarKir Kolyshkin <kir@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent bf5a8e13
...@@ -92,7 +92,7 @@ int main(int argc, char *argv[]) ...@@ -92,7 +92,7 @@ int main(int argc, char *argv[])
init_opts(); init_opts();
if (init_service_fd()) if (init_service_fd())
return -1; return 1;
while (1) { while (1) {
static const char short_opts[] = "dsRf:t:p:hcD:o:n:v::xVr:jlW:"; static const char short_opts[] = "dsRf:t:p:hcD:o:n:v::xVr:jlW:";
...@@ -175,7 +175,7 @@ int main(int argc, char *argv[]) ...@@ -175,7 +175,7 @@ int main(int argc, char *argv[])
break; break;
case 'n': case 'n':
if (parse_ns_string(optarg)) if (parse_ns_string(optarg))
return -1; return 1;
break; break;
case 'v': case 'v':
if (optarg) { if (optarg) {
...@@ -218,7 +218,7 @@ int main(int argc, char *argv[]) ...@@ -218,7 +218,7 @@ int main(int argc, char *argv[])
n = xmalloc(sizeof(*n)); n = xmalloc(sizeof(*n));
if (n == NULL) if (n == NULL)
return -1; return 1;
n->outside = strchr(optarg, '='); n->outside = strchr(optarg, '=');
if (n->outside == NULL) { if (n->outside == NULL) {
xfree(n); xfree(n);
...@@ -237,7 +237,7 @@ int main(int argc, char *argv[]) ...@@ -237,7 +237,7 @@ int main(int argc, char *argv[])
script = xmalloc(sizeof(struct script)); script = xmalloc(sizeof(struct script));
if (script == NULL) if (script == NULL)
return -1; return 1;
script->path = optarg; script->path = optarg;
list_add(&script->node, &opts.scripts); list_add(&script->node, &opts.scripts);
...@@ -253,7 +253,7 @@ int main(int argc, char *argv[]) ...@@ -253,7 +253,7 @@ int main(int argc, char *argv[])
opts.ps_port = htons(atoi(optarg)); opts.ps_port = htons(atoi(optarg));
if (!opts.ps_port) { if (!opts.ps_port) {
pr_err("Bad port\n"); pr_err("Bad port\n");
return -1; return 1;
} }
break; break;
case 'j': case 'j':
...@@ -293,19 +293,19 @@ int main(int argc, char *argv[]) ...@@ -293,19 +293,19 @@ int main(int argc, char *argv[])
ret = open_image_dir(imgs_dir); ret = open_image_dir(imgs_dir);
if (ret < 0) { if (ret < 0) {
pr_perror("Can't open imgs directory"); pr_perror("Can't open imgs directory");
return -1; return 1;
} }
} }
if (chdir(work_dir)) { if (chdir(work_dir)) {
pr_perror("Can't change directory to %s", work_dir); pr_perror("Can't change directory to %s", work_dir);
return -1; return 1;
} }
log_set_loglevel(log_level); log_set_loglevel(log_level);
if (log_init(opts.output)) if (log_init(opts.output))
return -1; return 1;
if (opts.img_parent) if (opts.img_parent)
pr_info("Will do snapshot from %s\n", opts.img_parent); pr_info("Will do snapshot from %s\n", opts.img_parent);
...@@ -384,7 +384,7 @@ usage: ...@@ -384,7 +384,7 @@ usage:
if (argc < 2) { if (argc < 2) {
pr_msg("\nTry -h|--help for more info\n"); pr_msg("\nTry -h|--help for more info\n");
return -1; return 1;
} }
pr_msg("\n" pr_msg("\n"
...@@ -445,9 +445,9 @@ usage: ...@@ -445,9 +445,9 @@ usage:
" --ms don't check not yet merged kernel features\n" " --ms don't check not yet merged kernel features\n"
); );
return -1; return 1;
opt_pid_missing: opt_pid_missing:
pr_msg("No pid specified (-t option missing)\n"); pr_msg("No pid specified (-t option missing)\n");
return -1; return 1;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment