commit - 9e7dd230e2eed399dd25ba034363eb1de5db66e9
commit + db066f1e66f888d1104b60c8b2899ea9d2e98e89
blob - d765c56dd04460ba921ebedf59bbce6c7623f18c
blob + eea4ea7edfb01cbce2c01a7b1c78fba5d2e80aea
--- kamiftp/ftp.c
+++ kamiftp/ftp.c
{
int fd;
- if ((fd = open(path, O_WRONLY|O_CREAT|O_TRUNC, 0644)) == -1) {
+ fd = open(path, O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0644);
+ if (fd == -1) {
warn("can't open %s", path);
return -1;
}
sock = -1;
for (res = res0; res != NULL; res = res->ai_next) {
- sock = socket(res->ai_family, res->ai_socktype,
+ sock = socket(res->ai_family, res->ai_socktype|SOCK_CLOEXEC,
res->ai_protocol);
if (sock == -1) {
cause = "socket";