Re: [hackers] [slock] [PATCH] Refactor main()
FRIGN wrote:
> See attached patch for a fixed version based on your suggestions.
Heyho,
thanks for the update. Apart from the points mentioned below, the changes look
good.
> - if (!getpwuid(getuid()))
> - die("no passwd entry for you\n");
> + /* Check if the current user has a password entry */
> + errno = 0;
> + if (!getpwuid(getuid())) {
> + if (errno == 0) {
> + die("slock: no password entry for current user\n");
> + } else {
> + die("slock: getpwuid: %s\n", strerror(errno));
> + }
> + }
According to the coding style the inner if should not have braces. If you want
to change the coding style, for consistencys sake please start a general
discussion about it before introducing your preference in patches.
> + /* run post-lock command */
> + if (argc > 0) {
> + switch(fork()) {
I think you want a space after the `switch`.
> diff --git a/util.h b/util.h
> index 6f748b8..4f170a2 100644
> --- a/util.h
> +++ b/util.h
> _AT_@ -1,2 +1,6 @@
> +#include "arg.h"
> +
> +extern char *argv0;
> +
> #undef explicit_bzero
> void explicit_bzero(void *, size_t);
Why do we need that level of inderection? We can just include arg.h from slock.c
directly.
--Markus
Received on Mon Aug 22 2016 - 12:32:28 CEST
This archive was generated by hypermail 2.3.0
: Mon Aug 22 2016 - 12:36:14 CEST