Ticket #230: chmod_HPFS386.diff
File chmod_HPFS386.diff, 3.8 KB (added by , 14 years ago) |
---|
-
b_fsFileModeSetFH.c
124 124 && pFH->pFsInfo 125 125 && pFH->pFsInfo->fUnixEAs) 126 126 { 127 /* 128 * Temporarily remove the FILE_READONLY bit because on some file 129 * systems (e.g. HPFS386) setting EAs on a read-only file fails with 130 * ERROR_ACCESS_DENIED. 131 */ 132 BOOL fResetReadOnly = FALSE; 133 if (fsts3.attrFile & FILE_READONLY) 134 { 135 fsts3.attrFile &= ~FILE_READONLY; 136 rc = DosSetFileInfo(fh, FIL_STANDARD, &fsts3, sizeof(fsts3)); 137 if (rc) 138 { 139 FS_RESTORE(); 140 rc = -__libc_native2errno(rc); 141 LIBCLOG_ERROR_RETURN_INT(rc); 142 } 143 fResetReadOnly = TRUE; 144 } 145 127 146 mode_t CurMode; 128 147 rc = __libc_back_fsUnixAttribsGetMode(fh, pFH->pszNativePath, &CurMode); 129 148 if (__predict_true(!rc)) … … 178 197 179 198 if (__predict_false(rc != 0)) 180 199 { 200 /* Restore the FILE_READONLY bit. */ 201 if (fResetReadOnly) 202 fsts3.attrFile &= ~FILE_READONLY; 203 DosSetFileInfo(fh, FIL_STANDARD, &fsts3, sizeof(fsts3)); 181 204 FS_RESTORE(); 182 205 LIBCLOG_ERROR_RETURN_INT(rc); 183 206 } -
b_fsNativeFileModeSet.c
126 126 } 127 127 128 128 /* 129 * Update OS/2 attributes. 129 * Update OS/2 attributes. Note that in fUnixEAs mode we temporarily remove 130 * the FILE_READONLY bit because on some file systems (e.g. HPFS386) setting 131 * EAs on a read-only file fails with ERROR_ACCESS_DENIED. 130 132 */ 131 133 #if OFF_MAX > LONG_MAX 132 134 if (fLarge) 133 135 { 134 if ( Mode & S_IWRITE)136 if (fUnixEAs) 135 137 info.fsts4L.attrFile &= ~FILE_READONLY; 136 138 else 137 info.fsts4L.attrFile = FILE_READONLY; 139 { 140 if (Mode & S_IWRITE) 141 info.fsts4L.attrFile &= ~FILE_READONLY; 142 else 143 info.fsts4L.attrFile |= FILE_READONLY; 144 } 138 145 rc = DosSetPathInfo((PCSZ)pszNativePath, FIL_STANDARDL, &info, sizeof(info.fsts4L) - sizeof(info.fsts4L.cbList), 0); 139 146 } 140 147 else 141 148 #endif 142 149 { 143 if ( Mode & S_IWRITE)150 if (fUnixEAs) 144 151 info.fsts4.attrFile &= ~FILE_READONLY; 145 152 else 146 info.fsts4.attrFile |= FILE_READONLY; 153 { 154 if (Mode & S_IWRITE) 155 info.fsts4.attrFile &= ~FILE_READONLY; 156 else 157 info.fsts4.attrFile |= FILE_READONLY; 158 } 147 159 rc = DosSetPathInfo((PCSZ)pszNativePath, FIL_STANDARD, &info, sizeof(info.fsts4) - sizeof(info.fsts4.cbList), 0); 148 160 } 149 161 if (__predict_false(rc != NO_ERROR)) … … 203 215 else if (rc == -ENOTSUP) 204 216 rc = 0; 205 217 218 /* Restore the FILE_READONLY bit. */ 219 if (!(Mode & S_IWRITE)) 220 { 221 #if OFF_MAX > LONG_MAX 222 if (fLarge) 223 { 224 info.fsts4L.attrFile |= FILE_READONLY; 225 DosSetPathInfo((PCSZ)pszNativePath, FIL_STANDARDL, &info, sizeof(info.fsts4L) - sizeof(info.fsts4L.cbList), 0); 226 } 227 else 228 #endif 229 { 230 info.fsts4.attrFile |= FILE_READONLY; 231 DosSetPathInfo((PCSZ)pszNativePath, FIL_STANDARD, &info, sizeof(info.fsts4) - sizeof(info.fsts4.cbList), 0); 232 } 233 } 234 206 235 if (__predict_false(rc != 0)) 207 236 { 208 237 FS_RESTORE();