[uClibc]fdopen() problem

michaels at jungo.com michaels at jungo.com
Tue Mar 13 11:23:49 UTC 2001


While using netkit's ftp client compiled against uClibc, I get an error
on fdopen.
I tried to track down the problem and arrived to a conclusion that the
follwoing code causes the return value of fdopen to be -1:
------------------------
stdio.c at line 710

	} else {   /* fdopen -- check mode is compatible. */
		cur_mode = fcntl(fd, F_GETFL);
		if ((cur_mode == -1) || ((cur_mode ^ open_mode) & O_ACCMODE)) {
			fd = -1;
		}
---------------------
I don't understand the ((cur_mode ^ open_mode) & O_ACCMODE) importance
to failure.
Can anyone claify this for me? 
Anyway I think the condition must be inverse: !((cur_mode ^ open_mode) &
O_ACCMODE)

-- 
Sincerely yours,
Michael Shmulevich
______________________________________
Software Developer
Jungo - R&D 
email: michaels at jungo.com
web: http://www.jungo.com
Phone: 1-877-514-0537(USA)  +972-9-8859365(Worldwide) ext. 233
Fax:   1-877-514-0538(USA)  +972-9-8859366(Worldwide)





More information about the uClibc mailing list