mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-01 20:29:00 +00:00
Check for too many arguments to hostname
Also use the symbolic value for the success exit code.
This commit is contained in:
parent
41ce7d40f6
commit
6993c66389
1 changed files with 7 additions and 1 deletions
|
|
@ -46,6 +46,12 @@ int main(int argc, FAR char *argv[])
|
|||
|
||||
if (argc > 1)
|
||||
{
|
||||
if (argc > 2)
|
||||
{
|
||||
fprintf(stderr, "ERROR: Too many arguments\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
ret = sethostname(argv[1], strlen(argv[1]));
|
||||
if (ret != 0)
|
||||
{
|
||||
|
|
@ -65,5 +71,5 @@ int main(int argc, FAR char *argv[])
|
|||
printf("%s\n", hostname);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue