Date: Mon, 13 Aug 2001 10:23:16 +0100 From: Ian Dowse <iedowse@maths.tcd.ie> To: Gabriel Ambuehl <gabriel_ambuehl@buz.ch> Cc: questions@freebsd.org Subject: Re: Re[2]: write() failing.. Message-ID: <200108131023.aa09406@salmon.maths.tcd.ie> In-Reply-To: Your message of "Mon, 13 Aug 2001 09:53:52 %2B0200." <138428502093.20010813095352@buz.ch>
next in thread | previous in thread | raw e-mail | index | archive | help
In message <138428502093.20010813095352@buz.ch>, Gabriel Ambuehl writes: >-----BEGIN PGP SIGNED MESSAGE----- > 58204 test_logfile CALL open(0x804f1f0,0x328,0xbfbffb80) > 58204 test_logfile NAMI "/var/log/some_log" > 58204 test_logfile RET open 3 ># so open returns with the correct file descriptor > 58204 test_logfile CALL write(0x3,0x8050010,0xb) ># write writes 0B bytes (which is about the length of hello world >;-)to file descriptor 3 > 58204 test_logfile RET write -1 errno 9 Bad file descriptor ># and the bad file descriptor bites Ah, you're missing the option O_WRONLY from the open flags: O_APPEND | O_CREAT | O_EXLOCK | O_NOFOLLOW should be O_WRONLY | O_APPEND | O_CREAT | O_EXLOCK | O_NOFOLLOW You are also missing the `mode' argument to open(), which is necessary when you specify O_CREAT. The "Bad file descriptor" error is documented on the `man 2 write' man page as [EBADF] d is not a valid descriptor open for writing. Ian To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi? <200108131023.aa09406>