Bug 6440 - possibly-ignored write error
Summary: possibly-ignored write error
Status: RESOLVED FIXED
Alias: None
Product: Samba 3.4
Classification: Unclassified
Component: Nmbd (show other bugs)
Version: unspecified
Hardware: Other Linux
: P3 normal
Target Milestone: ---
Assignee: Volker Lendecke
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-05 07:16 UTC by Jim Meyering
Modified: 2009-06-30 04:42 UTC (History)
1 user (show)

See Also:


Attachments
patch (78 bytes, patch)
2009-06-06 16:28 UTC, Volker Lendecke
no flags Details
patch (6.38 KB, patch)
2009-06-06 16:30 UTC, Volker Lendecke
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jim Meyering 2009-06-05 07:16:06 UTC
Hello,

This is in the git sources release-4-0-0alpha7-2044-gecd1fe2,
but release-3-4-0pre2 has the same code.

I began looking through samba sources for unchecked close calls.
The one at the end of check_magic in source3/smbd/close.c looks significant:

	transfer_file(tmp_fd,outfd,(SMB_OFF_T)st.st_ex_size);
	close(tmp_fd);
	close(outfd);
	TALLOC_FREE(ctx);
}

The problem is that close(outfd) is documented to be able to fail (indicating a write failure) even when all "write" syscalls have succeeded, and that is not detected.
Comment 1 Volker Lendecke 2009-06-06 16:28:38 UTC
Created attachment 4253 [details]
patch

Attached find a set of two patches. Does that fix the error for you?

BTW, this "magic script" thing is sooo deprecated.. :-)

Volker
Comment 2 Volker Lendecke 2009-06-06 16:30:14 UTC
Created attachment 4254 [details]
patch

Crap, forgot --stdout last time :-)

Volker
Comment 3 Jeremy Allison 2009-06-12 15:40:52 UTC
Pushed to master - thanks Volker !
Jeremy.
Comment 4 Karolin Seeger 2009-06-30 04:36:00 UTC
Should this one be included in 3.4.0?
Comment 5 Volker Lendecke 2009-06-30 04:41:33 UTC
No, I don't think so.

Thanks,

Volker
Comment 6 Volker Lendecke 2009-06-30 04:42:23 UTC
I don't think this is important enough to go into 3.4. As it's fixed in master, closing the bug.

Volker