aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorFRIGN <dev@frign.de>2016-09-23 09:37:59 +0200
committersin <sin@2f30.org>2016-09-23 09:33:22 +0100
commit731f65fc82afcd474f4c682f9f0069e5c80c86dd (patch)
treeeeee7ca226c59e22494087e66d762b075cfd79ee /util
parent40a9fd323646b680a4eb046076c606339fd7501e (diff)
Use switch for fork()
This saves us one local variable and 2 lines of code, while improving readability by using the switch-style we are used to from other suckless projects. We are allowed to check against -1, as POSIX clearly mandates for the RETURN VALUE: "Upon successful completion, fork() shall return 0 to the child process and shall return the process ID of the child process to the parent process. Both processes shall continue to execute from the fork() function. Otherwise, -1 shall be returned to the parent process, no child process shall be created, and errno shall be set to indicate the error." [http://pubs.opengroup.org/onlinepubs/9699919799/functions/fork.html] This way, checking against < 0 was overdoing it and it's sufficient to compare against -1, justifying the switch statement here.
Diffstat (limited to 'util')
0 files changed, 0 insertions, 0 deletions