rem: nwrote = write(wfd, p, towrite);
add: nwrote = write(wfd, p, (size_t)towrite);
context: NsTclCpObjCmd(ClientData arg, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){    int             nread, towrite, nwrote;    char            buf[4096], *src, *dst, *p, *emsg, *efile;    int             preserve, result, rfd, wfd;    struct stat     st;    struct utimbuf  ut;        if (objc != 3 && objc != 4) {badargs:        Tcl_WrongNumArgs(interp, 1, objv, "?-preserve? srcfile dstfile");        return TCL_ERROR;    }    wfd = rfd = -1;    result = TCL_ERROR;    if (objc == 3) {	preserve = 0;	src = Tcl_GetString(objv[1]);	dst = Tcl_GetString(objv[2]);    } else {	if (!STREQ(Tcl_GetString(objv[1]), "-preserve")) {	    goto badargs;	}	preserve = 1;	src = Tcl_GetString(objv[2]);	dst = Tcl_GetString(objv[3]);	if (stat(src, &st) != 0) {	    emsg = "stat";	    efile = src;	    goto done;        }    }    emsg = "open";    rfd = open(src, O_RDONLY|O_BINARY);    if (rfd < 0) {	efile = src;	goto done;    }    wfd = open(dst, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, 0644);    if (wfd < 0) {	efile = dst;	goto done;    }    while ((nread = read(rfd, buf, sizeof(buf))) > 0) {	p = buf;	towrite = nread;	while (towrite > 0) {	    nwrote = write(wfd, p, towrite);	    if (nwrote <= 0) {		emsg = "write";		efile = dst;		goto done;	    }	    towrite -= nwrote;	    p += nwrote;	}    }    if (nread < 0) {	emsg = "read";	efile = src;	goto done;    }    if (!preserve) {	result = TCL_OK;    } else {	efile = dst;	if (chmod(dst, st.st_mode) != 0) {	    emsg = "chmod";	    goto done;	}        ut.actime  = st.st_atime;        ut.modtime = st.st_mtime;        if (utime(dst, &ut) != 0) {	    emsg = "utime";	    goto done;	}	result = TCL_OK;    }done:    if (result != TCL_OK) {        Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "could not ", emsg, " \"",	            efile, "\": ", Tcl_PosixError(interp), NULL);    }    if (rfd >= 0) {	close(rfd);    }    if (wfd >= 0) {	close(wfd);    }    return result;}