rem: if ((theFile = fdopen(fd, "w")) == NULL) {
add: if ((theFile = fdopen(fd, "wb")) == NULL) {
context: WMWritePropListToFile(WMPropList *plist, char *path, Bool atomically){    char *thePath=NULL;    char *desc;    FILE *theFile;    if (atomically) {#ifdef	HAVE_MKSTEMP        int fd, mask;#endif        /* Use the path name of the destination file as a prefix for the         * mkstemp() call so that we can be sure that both files are on         * the same filesystem and the subsequent rename() will work. */        thePath = wstrconcat(path, ".XXXXXX");#ifdef  HAVE_MKSTEMP        if ((fd = mkstemp(thePath)) < 0) {            wsyserror(_("mkstemp (%s) failed"), thePath);            goto failure;        }        mask = umask(0);        umask(mask);        fchmod(fd, 0644 & ~mask);        if ((theFile = fdopen(fd, "w")) == NULL) {            close(fd);        }#else        if (mktemp(thePath) == NULL) {            wsyserror(_("mktemp (%s) failed"), thePath);            goto failure;        }        theFile = fopen(thePath, "wb");#endif    } else {        thePath = wstrdup(path);        theFile = fopen(thePath, "wb");    }    if (theFile == NULL) {        wsyserror(_("open (%s) failed"), thePath);        goto failure;    }    desc = indentedDescription(plist, 0);    if (fprintf(theFile, "%s\n", desc) != strlen(desc)+1) {        wsyserror(_("writing to file: %s failed"), thePath);        wfree(desc);        goto failure;    }    wfree(desc);    if (fclose(theFile) != 0) {        wsyserror(_("fclose (%s) failed"), thePath);        goto failure;    }    /* If we used a temporary file, we still need to rename() it be the     * real file.  Also, we need to try to retain the file attributes of     * the original file we are overwriting (if we are) */    if (atomically) {        if (rename(thePath, path) != 0) {            wsyserror(_("rename ('%s' to '%s') failed"), thePath, path);            goto failure;        }    }    wfree(thePath);    return True;failure:    if (atomically) {        unlink(thePath);        wfree(thePath);    }    return False;}