Changeset 3905


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.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/libc-0.6/src/emx/src/lib/sys/b_fsRename.c

    r2254 r3905  
    156156                                     * to retry the move operation and handle races with other
    157157                                     * processes somewhat ok...
     158                                     *
     159                                     * Try clear the read-only attribute on files before deleting them.
     160                                     * Directories cannot have read-only attributes on OS/2 it seems.
    158161                                     */
    159162                                    if (fsts3New.attrFile & FILE_DIRECTORY)
     
    163166                                        if (!rc2)
    164167                                            continue;
    165                                         else if (rc2 == ERROR_ACCESS_DENIED)
     168                                        if (rc2 == ERROR_ACCESS_DENIED)
    166169                                            rc = -ENOTEMPTY;
    167170                                        else
     
    170173                                    else
    171174                                    {
     175                                        if (fsts3New.attrFile & FILE_READONLY)
     176                                        {
     177                                            fsts3New.attrFile &= ~FILE_READONLY;
     178                                            rc2 = DosSetPathInfo((PCSZ)&szNativePathNew[0], FIL_STANDARD, &fsts3New,
     179                                                                 sizeof(fsts3New), 0 /*fOptions*/);
     180                                            LIBCLOG_MSG("DosSetPathInfo('%s',read-write) -> %d\n", szNativePathNew, rc2);
     181                                        }
     182
    172183                                        rc2 = DosDelete((PCSZ)&szNativePathNew[0]);
    173184                                        LIBCLOG_MSG("DosDelete('%s') -> %d\n", szNativePathNew, rc2);
    174185                                        if (!rc2)
    175186                                            continue;
    176                                         else
    177                                             rc = -__libc_native2errno(rc2);
     187                                        rc = -__libc_native2errno(rc2);
    178188                                    }
    179189                                }
  • 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.