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/cp_utils.c

    r3192 r3219  
    102102        *pcopied = 0;
    103103
    104         if ((from_fd = open(entp->fts_path, O_RDONLY | O_BINARY, 0)) == -1) {
     104        if ((from_fd = open(entp->fts_path, O_RDONLY | O_BINARY | KMK_OPEN_NO_INHERIT, 0)) == -1) {
    105105                warn(pCtx, "open: %s", entp->fts_path);
    106106                return (1);
     
    128128                        if (lseek(from_fd, 0, SEEK_SET) != 0) {
    129129                                close(from_fd);
    130                                 if ((from_fd = open(entp->fts_path, O_RDONLY | O_BINARY, 0)) == -1) {
     130                                if ((from_fd = open(entp->fts_path, O_RDONLY | O_BINARY | KMK_OPEN_NO_INHERIT, 0)) == -1) {
    131131                                        warn(pCtx, "open: %s", entp->fts_path);
    132132                                        return (1);
     
    157157                     * create a new file  */
    158158                    (void)unlink(to.p_path);
    159                     to_fd = open(to.p_path, O_WRONLY | O_TRUNC | O_CREAT | O_BINARY,
     159                    to_fd = open(to.p_path, O_WRONLY | O_TRUNC | O_CREAT | O_BINARY | KMK_OPEN_NO_INHERIT,
    160160                                 fs->st_mode & ~(S_ISUID | S_ISGID));
    161161                } else
    162162                    /* overwrite existing destination file name */
    163                     to_fd = open(to.p_path, O_WRONLY | O_TRUNC | O_BINARY, 0);
     163                    to_fd = open(to.p_path, O_WRONLY | O_TRUNC | O_BINARY | KMK_OPEN_NO_INHERIT, 0);
    164164        } else
    165                 to_fd = open(to.p_path, O_WRONLY | O_TRUNC | O_CREAT | O_BINARY,
     165                to_fd = open(to.p_path, O_WRONLY | O_TRUNC | O_CREAT | O_BINARY | KMK_OPEN_NO_INHERIT,
    166166                    fs->st_mode & ~(S_ISUID | S_ISGID));
    167167
Note: See TracChangeset for help on using the changeset viewer.