Ignore:
Timestamp:
Mar 31, 2018, 12:30:15 AM (7 years ago)
Author:
bird
Message:

kmkbuiltin: Added KMK_OPEN_NO_INHERIT to all open calls.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/kmkbuiltin/install.c

    r3215 r3219  
    551551        }
    552552
    553         if (!devnull && (from_fd = open(from_name, O_RDONLY | O_BINARY, 0)) < 0)
     553        if (!devnull && (from_fd = open(from_name, O_RDONLY | O_BINARY | KMK_OPEN_NO_INHERIT, 0)) < 0)
    554554                return err(pThis->pCtx, EX_OSERR, "%s", from_name);
    555555
    556556        /* If we don't strip, we can compare first. */
    557557        if (pThis->docompare && !pThis->dostrip && target) {
    558                 if ((to_fd = open(to_name, O_RDONLY | O_BINARY, 0)) < 0) {
     558                if ((to_fd = open(to_name, O_RDONLY | O_BINARY | KMK_OPEN_NO_INHERIT, 0)) < 0) {
    559559                        rc = err(pThis->pCtx, EX_OSERR, "%s", to_name);
    560560                        goto l_done;
     
    613613                close(to_fd);
    614614#endif
    615                 to_fd = open(tempcopy ? tempfile : to_name, O_RDONLY | O_BINARY, 0);
     615                to_fd = open(tempcopy ? tempfile : to_name, O_RDONLY | O_BINARY | KMK_OPEN_NO_INHERIT, 0);
    616616                if (to_fd < 0) {
    617617                        rc = err(pThis->pCtx, EX_OSERR, "stripping %s", to_name);
     
    627627
    628628                /* Re-open to_fd using the real target name. */
    629                 if ((to_fd = open(to_name, O_RDONLY | O_BINARY, 0)) < 0) {
     629                if ((to_fd = open(to_name, O_RDONLY | O_BINARY | KMK_OPEN_NO_INHERIT, 0)) < 0) {
    630630                        rc = err(pThis->pCtx, EX_OSERR, "%s", to_name);
    631631                        goto l_done;
     
    707707                /* Re-open to_fd so we aren't hosed by the rename(2). */
    708708                (void) close(to_fd);
    709                 if ((to_fd = open(to_name, O_RDONLY | O_BINARY, 0)) < 0) {
     709                if ((to_fd = open(to_name, O_RDONLY | O_BINARY | KMK_OPEN_NO_INHERIT, 0)) < 0) {
    710710                        rc = err(pThis->pCtx, EX_OSERR, "%s", to_name);
    711711                        goto l_done;
     
    913913        }
    914914
    915         newfd = open(path, O_CREAT | O_RDWR | O_TRUNC | O_BINARY, S_IRUSR | S_IWUSR);
     915        newfd = open(path, O_CREAT | O_RDWR | O_TRUNC | O_BINARY | KMK_OPEN_NO_INHERIT, S_IRUSR | S_IWUSR);
    916916        if (newfd < 0 && saved_errno != 0)
    917917                errno = saved_errno;
Note: See TracChangeset for help on using the changeset viewer.