Changeset 347 for trunk/src


Ignore:
Timestamp:
Dec 11, 2005, 6:12:41 AM (20 years ago)
Author:
bird
Message:

Open files in binary mode before copying!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gmake/kmkbuiltin/cp_utils.c

    r229 r347  
    5959#define MAXBSIZE (128*1024)
    6060#endif
     61#ifndef O_BINARY
     62# define O_BINARY 0
     63#endif
    6164
    6265int
     
    7477#endif
    7578
    76         if ((from_fd = open(entp->fts_path, O_RDONLY, 0)) == -1) {
     79        if ((from_fd = open(entp->fts_path, O_RDONLY | O_BINARY, 0)) == -1) {
    7780                fprintf(stderr, "%s: %s: %s\n", argv0, entp->fts_path, strerror(errno));
    7881                return (1);
     
    112115                     * create a new file  */
    113116                    (void)unlink(to.p_path);
    114                     to_fd = open(to.p_path, O_WRONLY | O_TRUNC | O_CREAT,
     117                    to_fd = open(to.p_path, O_WRONLY | O_TRUNC | O_CREAT | O_BINARY,
    115118                                 fs->st_mode & ~(S_ISUID | S_ISGID));
    116119                } else
    117120                    /* overwrite existing destination file name */
    118                     to_fd = open(to.p_path, O_WRONLY | O_TRUNC, 0);
     121                    to_fd = open(to.p_path, O_WRONLY | O_TRUNC | O_BINARY, 0);
    119122        } else
    120                 to_fd = open(to.p_path, O_WRONLY | O_TRUNC | O_CREAT,
     123                to_fd = open(to.p_path, O_WRONLY | O_TRUNC | O_CREAT | O_BINARY,
    121124                    fs->st_mode & ~(S_ISUID | S_ISGID));
    122125
Note: See TracChangeset for help on using the changeset viewer.