Ticket #288: rename.diff

File rename.diff, 1.9 KB (added by dmik, 10 years ago)
  • src/emx/src/lib/sys/b_fsRename.c

     
    169169                                    }
    170170                                    else
    171171                                    {
    172                                         rc2 = DosDelete((PCSZ)&szNativePathNew[0]);
    173                                         LIBCLOG_MSG("DosDelete('%s') -> %d\n", szNativePathNew, rc2);
     172                                        rc2 = NO_ERROR;
     173                                        if (fsts3New.attrFile & FILE_READONLY)
     174                                        {
     175                                            /* Read-only files can't be deleted; reset the flag */
     176                                            fsts3New.attrFile &= ~FILE_READONLY;
     177                                            rc2 = DosSetPathInfo((PCSZ)&szNativePathNew[0], FIL_STANDARD, &fsts3New, sizeof(fsts3New), 0);
     178                                        }
    174179                                        if (!rc2)
    175                                             continue;
    176                                         else
    177                                             rc = -__libc_native2errno(rc2);
     180                                        {
     181                                            rc2 = DosDelete((PCSZ)&szNativePathNew[0]);
     182                                            LIBCLOG_MSG("DosDelete('%s') -> %d\n", szNativePathNew, rc2);
     183                                            if (!rc2)
     184                                                continue;
     185                                        }
     186                                        rc = -__libc_native2errno(rc2);
    178187                                    }
    179188                                }
    180189                            }