[01/11] Cleanup exit code

Message ID 20180607065438.18257-1-mikey@neuling.org
State Accepted
Headers show
Series
  • [01/11] Cleanup exit code
Related show

Commit Message

Michael Neuling June 7, 2018, 6:54 a.m.
Signed-off-by: Michael Neuling <mikey@neuling.org>
---
 src/main.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

Comments

Alistair Popple June 15, 2018, 4:36 a.m. | #1
Thanks Mikey, series applied.

- Alistair

On Thursday, 7 June 2018 4:54:28 PM AEST Michael Neuling wrote:
> Signed-off-by: Michael Neuling <mikey@neuling.org>
> ---
>  src/main.c | 17 ++++++-----------
>  1 file changed, 6 insertions(+), 11 deletions(-)
> 
> diff --git a/src/main.c b/src/main.c
> index 85770ef78c..26e141076e 100644
> --- a/src/main.c
> +++ b/src/main.c
> @@ -622,16 +622,11 @@ int main(int argc, char *argv[])
>  	return 1;
>  
>  found_action:
> -	if (rc <= 0) {
> -                printf("No valid targets found or specified. Try adding -p/-c/-t options to specify a target.\n");
> -                printf("Alternatively run '%s -a probe' to get a list of all valid targets\n",
> -		       basename(argv[0]));
> -		rc = 1;
> -	} else
> -		rc = 0;
> +	if (rc > 0)
> +		return 0;
>  
> -	//if (backend == FSI)
> -		//fsi_destroy(NULL);
> -
> -	return rc;
> +	printf("No valid targets found or specified. Try adding -p/-c/-t options to specify a target.\n");
> +	printf("Alternatively run '%s -a probe' to get a list of all valid targets\n",
> +	       basename(argv[0]));
> +	return 1;
>  }
>

Patch

diff --git a/src/main.c b/src/main.c
index 85770ef78c..26e141076e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -622,16 +622,11 @@  int main(int argc, char *argv[])
 	return 1;
 
 found_action:
-	if (rc <= 0) {
-                printf("No valid targets found or specified. Try adding -p/-c/-t options to specify a target.\n");
-                printf("Alternatively run '%s -a probe' to get a list of all valid targets\n",
-		       basename(argv[0]));
-		rc = 1;
-	} else
-		rc = 0;
+	if (rc > 0)
+		return 0;
 
-	//if (backend == FSI)
-		//fsi_destroy(NULL);
-
-	return rc;
+	printf("No valid targets found or specified. Try adding -p/-c/-t options to specify a target.\n");
+	printf("Alternatively run '%s -a probe' to get a list of all valid targets\n",
+	       basename(argv[0]));
+	return 1;
 }