Author: des
Date: Fri Oct 16 12:53:22 2015
New Revision: 289420
URL: https://svnweb.freebsd.org/changeset/base/289420

Log:
  Use fopen()'s newfangled "e" flag instead of explicit fcntl() calls.
  
  PR:           199801
  Submitted by: Jukka Ukkonen <j...@iki.fi>
  MFC after:    1 week

Modified:
  head/lib/libfetch/file.c

Modified: head/lib/libfetch/file.c
==============================================================================
--- head/lib/libfetch/file.c    Fri Oct 16 12:21:44 2015        (r289419)
+++ head/lib/libfetch/file.c    Fri Oct 16 12:53:22 2015        (r289420)
@@ -48,7 +48,7 @@ fetchXGetFile(struct url *u, struct url_
        if (us && fetchStatFile(u, us, flags) == -1)
                return (NULL);
 
-       f = fopen(u->doc, "r");
+       f = fopen(u->doc, "re");
 
        if (f == NULL) {
                fetch_syserr();
@@ -61,7 +61,6 @@ fetchXGetFile(struct url *u, struct url_
                return (NULL);
        }
 
-       fcntl(fileno(f), F_SETFD, FD_CLOEXEC);
        return (f);
 }
 
@@ -77,9 +76,9 @@ fetchPutFile(struct url *u, const char *
        FILE *f;
 
        if (CHECK_FLAG('a'))
-               f = fopen(u->doc, "a");
+               f = fopen(u->doc, "ae");
        else
-               f = fopen(u->doc, "w+");
+               f = fopen(u->doc, "w+e");
 
        if (f == NULL) {
                fetch_syserr();
@@ -92,7 +91,6 @@ fetchPutFile(struct url *u, const char *
                return (NULL);
        }
 
-       fcntl(fileno(f), F_SETFD, FD_CLOEXEC);
        return (f);
 }
 
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to