Re: [evlog-dev] [BUG] writing wrong buffer to the socket in function writeKernEvt ()
Hien Q Nguyen <[email protected]> Thu, 9 Jan 2003 09:03:00 -0800
| Newsgroups | gmane.linux.kernel.event-logging |
|---|---|
| Message-ID | <[email protected]> |
Thanks for the finding. This is plain stupid and embarrassing :-) Best regards, Hien. Hien Nguyen [email protected] (503) 578-4347 |---------+--------------------------------------------> | | "Zhu, Yi" <[email protected]> | | | Sent by: | | | [email protected]| | | ceforge.net | | | | | | | | | 01/08/2003 10:42 PM | | | | |---------+--------------------------------------------> >-----------------------------------------------------------------------------------------------| | | | To: "'[email protected]'" | | <[email protected]> | | cc: | | Subject: [evlog-dev] [BUG] writing wrong buffer to the socket in function writeKernEvt | | () | | | | | >-----------------------------------------------------------------------------------------------| Hi, I find a bug in writeKernEvt when POSIX_LOG_TRUNCATE is turned on. Below is the fix. diff -Naur evlog/user/cmd/evlogd/evlogd.c evlog-new/user/cmd/evlogd/evlogd.c --- evlog/user/cmd/evlogd/evlogd.c 2002-12-20 09:51:41.000000000 +0800 +++ evlog-new/user/cmd/evlogd/evlogd.c 2003-01-09 14:37:26.000000000 +0800 @@ -1532,7 +1532,7 @@ */ bcopy((void *)buf, (void *)writebuf, entry->log_size); writebuf[POSIX_LOG_ENTRY_MAXLEN - 1] = '\0'; - if ((n = write(sd, buf, entry->log_size)) != entry->log_size) { + if ((n = write(sd, writebuf, entry->log_size)) != entry->log_size) { /* socket is broken */ fprintf(stderr, "Failed to write the msg body to evlog daemon.\n"); ret = EIO; ---------------------------------------------------------------------------- ---------------------------------------------------- Opinions expressed are those of the author and do not represent Intel Corp. Zhu Yi (Chuyee) Intel China Software Lab (ICSL) 22nd Floor, ShanghaiMart Tower No. 2299 Yan'an Road(West) Shanghai 200336, PRC Tel: 8621-52574545-1261 Fax: 8621-62366119 GnuPG v1.0.6 (GNU/Linux) http://cn.geocities.com/chewie_chuyee/gpg.txt 1024D/71C34820 C939 2B0B FBCE 1D51 109A 55E5 8650 DB90 71C3 4820 ------------------------------------------------------- This SF.NET email is sponsored by: SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! http://www.vasoftware.com _______________________________________________ evlog-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/evlog-developers ------------------------------------------------------- This SF.NET email is sponsored by: SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! http://www.vasoftware.com