aboutsummaryrefslogtreecommitdiff
path: root/src/protocol_ssh.c
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2018-07-18 12:53:50 +0200
committerToni Uhlig <matzeton@googlemail.com>2018-07-18 12:53:50 +0200
commit13f00c707e4738dfa0348bcc876ac989cf949a75 (patch)
treebcfbf1bd10b581705b8b0d51c25411ebde3e7efa /src/protocol_ssh.c
parent909433dde936ba5cc084c0fa2e6239c7011bd49d (diff)
Coverity CID 301779: check return value of chmod()
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'src/protocol_ssh.c')
-rw-r--r--src/protocol_ssh.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/protocol_ssh.c b/src/protocol_ssh.c
index 72f363d..9bbcc94 100644
--- a/src/protocol_ssh.c
+++ b/src/protocol_ssh.c
@@ -327,7 +327,8 @@ static int gen_default_keys(void)
s |= system(cmd);
} else s++;
}
- chmod(path, S_IRWXU);
+ if (chmod(path, S_IRUSR))
+ return 1;
if (pwd)
chown(path, pwd->pw_uid, pwd->pw_gid);
@@ -342,7 +343,8 @@ static int gen_default_keys(void)
s |= system(cmd);
} else s++;
}
- chmod(path, S_IRWXU);
+ if (chmod(path, S_IRUSR))
+ return 1;
if (pwd)
chown(path, pwd->pw_uid, pwd->pw_gid);
@@ -357,7 +359,8 @@ static int gen_default_keys(void)
s |= system(cmd);
} else s++;
}
- chmod(path, S_IRWXU);
+ if (chmod(path, S_IRUSR))
+ return 1;
if (pwd)
chown(path, pwd->pw_uid, pwd->pw_gid);