| www.delorie.com/archives/browse.cgi | search |
| Mailing-List: | contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm |
| List-Subscribe: | <mailto:cygwin-subscribe AT sources DOT redhat DOT com> |
| List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT sources DOT redhat DOT com> |
| List-Help: | <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs> |
| Sender: | cygwin-owner AT sources DOT redhat DOT com |
| Delivered-To: | mailing list cygwin AT sources DOT redhat DOT com |
| Date: | Wed, 14 Nov 2001 13:53:53 +0900 (JST) |
| Message-Id: | <20011114.135353.111406103.gotoh@taiyo.co.jp> |
| To: | rreitz AT mssinternet DOT com |
| Cc: | cygwin AT cygwin DOT com |
| Subject: | Re: 1.3.5: write(2) system call fails with 0 length |
| From: | Shun-ichi GOTO <gotoh AT taiyo DOT co DOT jp> |
| In-Reply-To: | <5.1.0.14.2.20011113215143.03327810@pop.mssinternet.com> |
| References: | <5 DOT 1 DOT 0 DOT 14 DOT 2 DOT 20011113215143 DOT 03327810 AT pop DOT mssinternet DOT com> |
| X-Mailer: | Mew version 2.1 on Emacs 20.7 / Mule 4.1 (AOI) |
| X-Cite-Me: | =?iso-2022-jp?B?GyRCOGUbKEI=?= |
| Mime-Version: | 1.0 |
>>>>> at Tue, 13 Nov 2001 21:58:32 -0600
>>>>> Randy Reitz <rreitz AT mssinternet DOT com> said,>
> Here is a test program....
It's strange test.
Do like this, and get result: "2nd write() failed: Bad address".
So you should give valid pointer as 2nd argument of 2nd write() call.
for example, write (fd, buf, 0);
main()
{
int fd, ret;
char * buf[4];
buf[0] = buf[1] = buf[2] = buf[3] = '0';
fd = open( "foo", O_RDWR|O_CREAT ); /* O_CREATE required */
if (fd < 0) {
perror("open() failed");
exit(1);
}
ret = write( fd, (char *) buf, 4);
if (ret < 0) {
perror("1st write() failed");
exit(2);
}
ret = write( fd, (char *)0, 0); /* NULL ptr is not allowed */
if (ret < 0) {
perror("2nd write() failed");
exit(3);
}
printf("ret=%d, errno=%d\n", ret, errno);
close( fd );
}
--- Regards,
Shun-ichi Goto <gotoh AT taiyo DOT co DOT jp>
R&D Group, TAIYO Corp., Tokyo, JAPAN
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |