From 829ebcd4a17602e3ff109a96dc60ac5bbc444991 Mon Sep 17 00:00:00 2001 From: "K. Lange" Date: Mon, 29 Oct 2018 21:21:39 +0900 Subject: [PATCH] esh: fix output for fg, bg when no jobs --- apps/sh.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/apps/sh.c b/apps/sh.c index 3fe2b887..e6c5fce4 100644 --- a/apps/sh.c +++ b/apps/sh.c @@ -1941,8 +1941,7 @@ int get_available_job(int argc, char * argv[]) { list_free(keys); free(keys); if (!suspended_pgid) { - fprintf(stderr, "no current job\n"); - return 1; + return 0; } } return suspended_pgid; @@ -1954,7 +1953,7 @@ int get_available_job(int argc, char * argv[]) { uint32_t shell_cmd_fg(int argc, char * argv[]) { int pid = get_available_job(argc,argv); if (!pid || !hashmap_has(job_hash, (void*)pid)) { - fprintf(stderr, "invalid job"); + fprintf(stderr, "no current job\n"); return 1; } @@ -1970,7 +1969,7 @@ uint32_t shell_cmd_fg(int argc, char * argv[]) { uint32_t shell_cmd_bg(int argc, char * argv[]) { int pid = get_available_job(argc,argv); if (!pid || !hashmap_has(job_hash, (void*)pid)) { - fprintf(stderr, "invalid job"); + fprintf(stderr, "no current job\n"); return 1; }