pike.git / src / modules / _Stdio / efuns.c

version» Context lines:

pike.git/src/modules/_Stdio/efuns.c:1671:    * permissions on the file itself before removing it. */    if (chmod (str2->str, st.st_mode | _S_IWRITE))    goto no_nt_rename_kludge;    if (movefileex (str1->str, str2->str, MOVEFILE_REPLACE_EXISTING))    i = 0; /* Success. */    else    chmod (str2->str, st.st_mode);    }       else { -  char *s = malloc (str2->len + 2), *p; +  /* NB: 3 == 2 bytes temporary suffix and 1 byte NUL-terminator. */ +  char *s = malloc (str2->len + 3), *p;    if (!s) {    i = movefileex ? ERROR_NOT_ENOUGH_MEMORY : ENOMEM;    goto no_nt_rename_kludge;    }    memcpy (s, str2->str, str2->len);    p = s + str2->len;    p[2] = 0;       if ((st.st_mode & S_IFMT) == S_IFDIR) {    /* Check first that the target is empty if it's a directory, so