Skip to content

Commit

Permalink
doc: don't return -1 from main in manpage examples
Browse files Browse the repository at this point in the history
It is custom for C functions to return a negative integer to denote
an error. This should not be done with main() though, as the return
value is used as an exit code, which is a byte (unsigned char), so
return -1 becomes 255, which is unconventional.

Fix examples where main returns -1 to return 1.

Signed-off-by: Kir Kolyshkin <[email protected]>
Reviewed-by: Tom Hromatka <[email protected]>
[PM: subject line tweaks]
Signed-off-by: Paul Moore <[email protected]>
  • Loading branch information
kolyshkin authored and pcmoore committed Mar 5, 2021
1 parent d5ad836 commit 6d5a0bb
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion doc/man/man3/seccomp_api_get.3
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ int main(int argc, char *argv[])
return 0;

err:
return \-1;
return 1;
}
.fi
.\" //////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion doc/man/man3/seccomp_release.3
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ int main(int argc, char *argv[])

ctx = seccomp_init(SCMP_ACT_KILL);
if (ctx == NULL)
return \-1;
return 1;

/* ... */

Expand Down
2 changes: 1 addition & 1 deletion doc/man/man3/seccomp_version.3
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ int main(int argc, char *argv[])
return 0;

err:
return \-1;
return 1;
}
.fi
.\" //////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit 6d5a0bb

Please sign in to comment.