Changeset 1680
- Timestamp:
- Dec 2, 2004, 8:00:37 AM (21 years ago)
- Location:
- trunk/src/emx/src/lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/src/lib/libc.def
-
Property cvs2svn:cvs-rev
changed from
1.83
to1.84
r1679 r1680 1275 1275 "DosLoadModuleEx" @1292 1276 1276 "DosFreeModuleEx" @1293 1277 "___libc_Back_fsRename" @1294 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/b_fsRename.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1679 r1680 103 103 if (!strcmp(&szNativePathOld[0], &szNativePathNew[0])) 104 104 rc = 0; 105 else if (rc != ERROR_SHARING_VIOLATION)105 else 106 106 { 107 107 /* … … 110 110 */ 111 111 FILESTATUS3 fsts3Old; 112 rc= DosQueryPathInfo((PCSZ)&szNativePathOld[0], FIL_STANDARD, &fsts3Old, sizeof(fsts3Old));113 if (rc )112 int rc2 = DosQueryPathInfo((PCSZ)&szNativePathOld[0], FIL_STANDARD, &fsts3Old, sizeof(fsts3Old)); 113 if (rc2) 114 114 { 115 115 /* … … 117 117 * Anyway, we're done. 118 118 */ 119 rc = -__libc_native2errno(rc );119 rc = -__libc_native2errno(rc2); 120 120 } 121 121 else 122 122 { 123 FILESTATUS3 fsts3New; 124 rc = DosQueryPathInfo((PCSZ)&szNativePathNew[0], FIL_STANDARD, &fsts3New, sizeof(fsts3New)); 125 if (rc) 126 { 127 /* 128 * No target, source must be busy doing something. 129 */ 123 /* 124 * This is where we stop with ERROR_SHARING_VIOLATION. 125 */ 126 if (rc == ERROR_SHARING_VIOLATION) 130 127 rc = fsts3Old.attrFile & FILE_DIRECTORY ? -EBUSY : -ETXTBSY; 131 }132 128 else 133 129 { 134 if ( (fsts3New.attrFile & FILE_DIRECTORY) 135 && !(fsts3Old.attrFile & FILE_DIRECTORY)) 130 FILESTATUS3 fsts3New; 131 rc2 = DosQueryPathInfo((PCSZ)&szNativePathNew[0], FIL_STANDARD, &fsts3New, sizeof(fsts3New)); 132 if (rc2) 136 133 { 137 134 /* 138 * The target is a directory while the source is not.135 * No target, source must be busy doing something. 139 136 */ 140 rc = -EISDIR;137 rc = fsts3Old.attrFile & FILE_DIRECTORY ? -EBUSY : -ETXTBSY; 141 138 } 142 139 else 143 140 { 144 /* 145 * Ok, now we start cooking. 146 * 147 * This should've been done atomically, but non-atomically is 148 * better than not doing anything (usually). We use the loop 149 * to retry the move operation and handle races with other 150 * processes somewhat ok... 151 */ 152 if (fsts3New.attrFile & FILE_DIRECTORY) 141 if ( (fsts3New.attrFile & FILE_DIRECTORY) 142 && !(fsts3Old.attrFile & FILE_DIRECTORY)) 153 143 { 154 rc = DosDeleteDir((PCSZ)&szNativePathNew[0]); 155 LIBCLOG_MSG("DosDeleteDir('%s') -> %d\n", szNativePathNew, rc); 156 if (!rc) 157 continue; 158 else if (rc == ERROR_ACCESS_DENIED) 159 rc = -ENOTEMPTY; 160 else 161 rc = -__libc_native2errno(rc); 144 /* 145 * The target is a directory while the source is not. 146 */ 147 rc = -EISDIR; 162 148 } 163 149 else 164 150 { 165 rc = DosDelete((PCSZ)&szNativePathNew[0]); 166 LIBCLOG_MSG("DosDelete('%s') -> %d\n", szNativePathNew, rc); 167 if (!rc) 168 continue; 151 /* 152 * Ok, now we start cooking. 153 * 154 * This should've been done atomically, but non-atomically is 155 * better than not doing anything (usually). We use the loop 156 * to retry the move operation and handle races with other 157 * processes somewhat ok... 158 */ 159 if (fsts3New.attrFile & FILE_DIRECTORY) 160 { 161 rc2 = DosDeleteDir((PCSZ)&szNativePathNew[0]); 162 LIBCLOG_MSG("DosDeleteDir('%s') -> %d\n", szNativePathNew, rc2); 163 if (!rc2) 164 continue; 165 else if (rc2 == ERROR_ACCESS_DENIED) 166 rc = -ENOTEMPTY; 167 else 168 rc = -__libc_native2errno(rc2); 169 } 169 170 else 170 rc = -__libc_native2errno(rc); 171 { 172 rc2 = DosDelete((PCSZ)&szNativePathNew[0]); 173 LIBCLOG_MSG("DosDelete('%s') -> %d\n", szNativePathNew, rc2); 174 if (!rc2) 175 continue; 176 else 177 rc = -__libc_native2errno(rc2); 178 } 171 179 } 172 173 180 } 174 } 181 } /* !ERROR_SHARING_VIOLATION */ 175 182 } 176 183 } 177 else if (rc == ERROR_DIRECTORY_IN_CDS || rc == ERROR_CIRCULARITY_REQUESTED)178 rc = -EINVAL;179 else180 rc = -__libc_native2errno(rc);181 184 } 185 else if (rc == ERROR_DIRECTORY_IN_CDS || rc == ERROR_CIRCULARITY_REQUESTED) 186 rc = -EINVAL; 187 else 188 rc = -__libc_native2errno(rc); 182 189 break; 183 190 } -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.