|
|
ru.linux- RU.LINUX --------------------------------------------------------------------- From : Valentin Nechayev 2:5020/400 25 Jan 2003 20:47:50 To : Dmitry Fedorov Subject : Re: научный вопрос -------------------------------------------------------------------------------- >>> Dmitry Fedorov wrote: >>Вот грабля тут есть - не всегда close() завершается успешно с закрытием >>дескриптора, бывают (хотя крайне редко) и более извратные позы. DF> Hикакой грабли, rtfm close - он всегда закрывает дескриптор, DF> даже если вернул ошибку. Вот именно, сделайте RTFM. SUSv3/Posix.1-2001: RETURN VALUE Upon successful completion, 0 shall be returned; otherwise, -1 shall be returned and errno set to indicate the error. BSD man: RETURN VALUES The close() function returns the value 0 if successful; otherwise the value -1 is returned and the global variable errno is set to indicate the error. Linux man: NOTES Not checking the return value of close is a common but nevertheless serious programming error. It is quite pos- sible that errors on a previous write(2) operation are first reported at the final close. Not checking the return value when closing the file may lead to silent loss of data. This can especially be observed with NFS and disk quotas. Hигде нет слов, что при неуспешном завершении дескриптор оказывается закрытым. Особо радует в линуховом и BSD мане: ERRORS [...] EINTR The close() call was interrupted by a signal. Так что - говорите, откуда Вы выкопали, что дескриптор всегда закрывается, или признавайтесь, что спороли херню. -netch- --- ifmail v.2.15dev5 * Origin: Dark side of coredump (2:5020/400) Вернуться к списку тем, сортированных по: возрастание даты уменьшение даты тема автор
Архивное /ru.linux/736808352a2a.html, оценка из 5, голосов 10
|