Repository navigation
Commit aa9b9d9
committed
cp: only apply setuid/setgid bits after setting the ownership
When creating the destination, cp chmod'ed it to the source mode,
setuid/setgid included, before copy_attributes() changed its owner.
With -p/-a the copy was briefly (or, if the chown failed, permanently)
a setuid/setgid file still owned by the user running cp.
Like GNU, clear these bits in the initial mode; when the mode is
preserved, copy_attributes() sets them again after the chown.1 parent 1614fa9 commit aa9b9d9
2 files changed
Lines changed: 42 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2757 | 2757 | | |
2758 | 2758 | | |
2759 | 2759 | | |
2760 | | - | |
2761 | | - | |
| 2760 | + | |
| 2761 | + | |
| 2762 | + | |
| 2763 | + | |
2762 | 2764 | | |
2763 | 2765 | | |
2764 | 2766 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9391 | 9391 | | |
9392 | 9392 | | |
9393 | 9393 | | |
| 9394 | + | |
| 9395 | + | |
| 9396 | + | |
| 9397 | + | |
| 9398 | + | |
| 9399 | + | |
| 9400 | + | |
| 9401 | + | |
| 9402 | + | |
| 9403 | + | |
| 9404 | + | |
| 9405 | + | |
| 9406 | + | |
| 9407 | + | |
| 9408 | + | |
| 9409 | + | |
| 9410 | + | |
| 9411 | + | |
| 9412 | + | |
| 9413 | + | |
| 9414 | + | |
| 9415 | + | |
| 9416 | + | |
| 9417 | + | |
| 9418 | + | |
| 9419 | + | |
| 9420 | + | |
| 9421 | + | |
| 9422 | + | |
| 9423 | + | |
| 9424 | + | |
| 9425 | + | |
| 9426 | + | |
| 9427 | + | |
| 9428 | + | |
| 9429 | + | |
| 9430 | + | |
| 9431 | + | |
9394 | 9432 | | |
9395 | 9433 | | |
9396 | 9434 | | |
| |||
0 commit comments