Commit 41b71f9
authored
Fix race condition in CFPreferences (#4903)
In __CFWriteBytesToFileWithAtomicity(), we first write the contents of the plist
to an auxiliary copy file, and then move that copy to where the original used to
be. Because that file needs to have the same owner as the original, we would use
chown() to change ownership as the last step. This allows a race condition where
the new file is in its final location, but doesn't have the correct permissions.
To fix this, call chown() on the file before moving.
rdar://1215976421 parent 1dac113 commit 41b71f9
1 file changed
+4
-5
lines changedLines changed: 4 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
273 | 273 | | |
274 | 274 | | |
275 | 275 | | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
276 | 280 | | |
277 | 281 | | |
278 | 282 | | |
279 | 283 | | |
280 | 284 | | |
281 | 285 | | |
282 | 286 | | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | 287 | | |
289 | 288 | | |
290 | 289 | | |
| |||
0 commit comments