Use fopen()'s newfangled "e" flag instead of explicit fcntl() calls.

PR:		199801
Submitted by:	Jukka Ukkonen <jau@iki.fi>
MFC after:	1 week
This commit is contained in:
Dag-Erling Smørgrav 2015-10-16 12:53:22 +00:00
parent c3f9b93bd9
commit 8819003234

View File

@ -48,7 +48,7 @@ fetchXGetFile(struct url *u, struct url_stat *us, const char *flags)
if (us && fetchStatFile(u, us, flags) == -1) if (us && fetchStatFile(u, us, flags) == -1)
return (NULL); return (NULL);
f = fopen(u->doc, "r"); f = fopen(u->doc, "re");
if (f == NULL) { if (f == NULL) {
fetch_syserr(); fetch_syserr();
@ -61,7 +61,6 @@ fetchXGetFile(struct url *u, struct url_stat *us, const char *flags)
return (NULL); return (NULL);
} }
fcntl(fileno(f), F_SETFD, FD_CLOEXEC);
return (f); return (f);
} }
@ -77,9 +76,9 @@ fetchPutFile(struct url *u, const char *flags)
FILE *f; FILE *f;
if (CHECK_FLAG('a')) if (CHECK_FLAG('a'))
f = fopen(u->doc, "a"); f = fopen(u->doc, "ae");
else else
f = fopen(u->doc, "w+"); f = fopen(u->doc, "w+e");
if (f == NULL) { if (f == NULL) {
fetch_syserr(); fetch_syserr();
@ -92,7 +91,6 @@ fetchPutFile(struct url *u, const char *flags)
return (NULL); return (NULL);
} }
fcntl(fileno(f), F_SETFD, FD_CLOEXEC);
return (f); return (f);
} }