safe

Password protected secret keeper
git clone git://git.z3bra.org/safe.git
Log | Files | Refs | README | LICENSE

commit bb62f9a683ea01c1a4018864aaf00e4adff65915
parent b8dbdc4755041d3c11180863f2d56f037fb81952
Author: Willy Goiffon <dev@z3bra.org>
Date:   Mon, 27 May 2019 17:54:06 +0200

Merge some functions calls and return statements together

Diffstat:
safe.c | 11++++-------
1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/safe.c b/safe.c @@ -259,8 +259,7 @@ getkey(char *path, uint8_t *key, uint8_t *salt) addr.sun_family = AF_UNIX; strcpy(addr.sun_path, path); - sfd = socket(AF_UNIX, SOCK_STREAM, 0); - if (sfd < 0) + if ((sfd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) err(1, "socket %s", path); if (connect(sfd, (struct sockaddr *)&addr, sizeof(addr)) < 0) @@ -351,17 +350,15 @@ main(int argc, char *argv[]) if (argc != 1 && !dflag) usage(); - if (dflag) { - agent(sockp); - return 0; - } - if (safe) { mkdir(safe, 0700); if (chdir(safe) < 0) err(1, "chdir: %s", safe); } + if (dflag) + return agent(sockp); + secret = argv[0]; if (aflag) {