| Summary: | SCP inappropriate truncate error when copying to FIFO file | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | Portable OpenSSH | Reporter: | Tom Wood <wood> | ||||||
| Component: | scp | Assignee: | Damien Miller <djm> | ||||||
| Status: | CLOSED FIXED | ||||||||
| Severity: | normal | ||||||||
| Priority: | P2 | ||||||||
| Version: | 4.3p2 | ||||||||
| Hardware: | ix86 | ||||||||
| OS: | All | ||||||||
| Bug Depends on: | |||||||||
| Bug Blocks: | 1289 | ||||||||
| Attachments: |
|
||||||||
|
Description
Tom Wood
2006-09-25 11:43:50 AEST
Created attachment 1189 [details]
Add test for FIFO file in scp.c prior to truncate attempt.
Created attachment 1304 [details]
Truncate only for regular files that already existed
I think this patch is a little better - it will skip the truncate if the file did not already exist or if the target is anything but a regular file.
Damien,
Your fix to this problem
"if (wrerr == NO && (!exists || S_ISREG(stb.st_mode)) &&
ftruncate(ofd, size) != 0) {"
looks like it will work just fine with a FIFO file target.This logic
restricts the ftruncate test much more than my fix. As lonk as
thats appropriate for all mode types, I agrre it is the right thing to
do.
Thanks
Tom
Fix applied, this will be in OpenSSH 4.7 - thanks! Close resolved bugs after release. |