Changeset 759


Ignore:
Timestamp:
May 12, 2016, 5:44:45 PM (9 years ago)
Author:
Yuri Dario
Message:

rpm: remove read-only flag before unlocking modules. fixes ticket#180.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified rpm/trunk/lib/fsm.c

    r594 r759  
    125125    // try replacing the module first
    126126    rc = DosReplaceModule( (PCSZ)NewName, (PCSZ)OldName, NULL);
    127     if (rc == NO_ERROR) {
     127    // if module is read-only, rename fails
     128    if (rc == ERROR_ACCESS_DENIED) {
     129      // unlock module
     130      rc = DosReplaceModule( (PCSZ)NewName, NULL, NULL);
     131      // remove read-only
     132      rc = chmod( OldName, S_IREAD|S_IWRITE);
     133      rc = chmod( NewName, S_IREAD|S_IWRITE);
     134      // retry replacement
     135      rc = DosReplaceModule( (PCSZ)NewName, (PCSZ)OldName, NULL);
     136    }
     137    if (rc == NO_ERROR || rc == ERROR_MODULE_IN_USE) {
    128138      // delete temp file
    129139      rc = unlink( OldName);
Note: See TracChangeset for help on using the changeset viewer.