Changeset 3905 for trunk


Ignore:
Timestamp:
Oct 24, 2014, 12:35:09 AM (11 years ago)
Author:
bird
Message:

trunk,0.6: b_fsRename.c: Overwrite read-only target files to be more unix compatible. Fixes #288.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libc/src/kNIX/os2/b_fsRename.c

    r3862 r3905  
    144144                                     * to retry the move operation and handle races with other
    145145                                     * processes somewhat ok...
     146                                     *
     147                                     * Try clear the read-only attribute on files before deleting them.
     148                                     * Directories cannot have read-only attributes on OS/2 it seems.
    146149                                     */
    147150                                    if (fsts3New.attrFile & FILE_DIRECTORY)
     
    151154                                        if (!rc2)
    152155                                            continue;
    153                                         else if (rc2 == ERROR_ACCESS_DENIED)
     156                                        if (rc2 == ERROR_ACCESS_DENIED)
    154157                                            rc = -ENOTEMPTY;
    155158                                        else
     
    158161                                    else
    159162                                    {
     163                                        if (fsts3New.attrFile & FILE_READONLY)
     164                                        {
     165                                            fsts3New.attrFile &= ~FILE_READONLY;
     166                                            rc2 = DosSetPathInfo((PCSZ)&szNativePathNew[0], FIL_STANDARD, &fsts3New,
     167                                                                 sizeof(fsts3New), 0 /*fOptions*/);
     168                                            LIBCLOG_MSG("DosSetPathInfo('%s',read-write) -> %d\n", szNativePathNew, rc2);
     169                                        }
     170
    160171                                        rc2 = DosDelete((PCSZ)&szNativePathNew[0]);
    161172                                        LIBCLOG_MSG("DosDelete('%s') -> %d\n", szNativePathNew, rc2);
    162173                                        if (!rc2)
    163174                                            continue;
    164                                         else
    165                                             rc = -__libc_back_native2errno(rc2);
     175                                        rc = -__libc_back_native2errno(rc2);
    166176                                    }
    167177                                }
Note: See TracChangeset for help on using the changeset viewer.