fdasd: Fix exit status in error cases

In error cases, fdasd returns -1 which results in the return value 255.
This is due to the fact that only the low-order 8 bits are used for the
status value. See 2.13 Status Information [1] in the POSIX standard and
the exit() POSIX man page [2] for more details.

Instead of returning -1, use the EXIT_FAILURE constant to indicate
unsuccessful termination properly.

[1]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html
[2]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/exit.html

Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Jan Höppner
2019-07-31 15:25:00 +02:00
parent 8b3cc6e4c1
commit 80443ab629

View File

@@ -397,7 +397,7 @@ static void fdasd_error(fdasd_anchor_t *anc, enum fdasd_failure why, char *str)
fputc('\n', stderr);
fputs(err_str, stderr);
fdasd_exit(anc, -1);
fdasd_exit(anc, EXIT_FAILURE);
}
/*
@@ -3040,5 +3040,5 @@ int main(int argc, char *argv[])
}
}
return -1;
return EXIT_FAILURE;
}