From: Mat Harris <mat.harris@genestate.com>
To: linux-c-programming@vger.kernel.org
Subject: SOLVED: Re: writing logfile
Date: Thu, 27 Feb 2003 10:32:38 +0000 [thread overview]
Message-ID: <20030227103238.A7438@genestate.com> (raw)
In-Reply-To: <20030227100415.A6471@genestate.com>; from mat.harris@genestate.com on Thu, Feb 27, 2003 at 10:04:15 +0000
[-- Attachment #1: Type: text/plain, Size: 2116 bytes --]
it's alright, i was closing the logfile inside the connection loop so it was
printing to a null filehandle and got confused.
On Thu, Feb 27, 2003 at 10:04:15 +0000, Mat Harris wrote:
> ok, thanks guys for the help with my webserver, the loggin works fine and now
> I have remembered about extern void etc I have put the functions to compile
> seperateley as suggested.
>
> Just one more thing tho, the logmessage is getting printed to the client's
> browser after any html content has been transferred and I can't see where it
> is happening. I have put a tarball of the whole thing at
>
> http://www.genestate.com/~matthewh/debug/
>
> thanks again.
>
> On Wed, Feb 26, 2003 at 07:45:07 +0000, Glynn Clements wrote:
> >
> > Mat Harris wrote:
> >
> > > ok and now i am getting something weird. when I try to log a successful
> > > request, and then make the request again, it ands to the previous printf
> > > message and prints it again so it repeats all the previous messages again
> > > and again. Also, the garbage in the logfile is the beginning of my webroot
> > > "/home....". I do not know what is going on here.
> >
> > Line 52 of webserver.c:
> >
> > > strcat(logmsg, filename);
> >
> > should be
> >
> > strcpy(logmsg, filename);
> >
> > Also:
> >
> > > #include "log.h" /* logging functions */
> >
> > Don't use #include for actual code. Put it in a separate .c file and
> > compile it separately.
> >
> > > void write_log(int loghandle, char *string)
> > > {
> > > write(loghandle, string, sizeof(string));
> > > }
> >
> > write(loghandle, string, strlen(string));
> >
> > Applying sizeof() to a "char *" will return the size of the pointer
> > (typically 4 on a 32-bit system, 8 on a 64-bit system), not the length
> > of the string to which it points.
> >
> > --
> > Glynn Clements <glynn.clements@virgin.net>
>
> --
> Mat Harris OpenGPG Public Key ID: C37D57D9
> mat.harris@genestate.com www.genestate.com
--
Mat Harris OpenGPG Public Key ID: C37D57D9
mat.harris@genestate.com www.genestate.com
[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]
prev parent reply other threads:[~2003-02-27 10:32 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-02-25 10:57 writing logfile Mat Harris
2003-02-25 11:38 ` Elias Athanasopoulos
2003-02-25 12:49 ` Mat Harris
2003-02-25 13:09 ` William N. Zanatta
2003-02-25 13:11 ` Mat Harris
2003-02-25 14:10 ` Elias Athanasopoulos
2003-02-25 14:18 ` Elias Athanasopoulos
2003-02-26 1:09 ` Glynn Clements
2003-02-26 9:25 ` Mat Harris
2003-02-26 10:09 ` Jan-Benedict Glaw
2003-02-26 10:18 ` Mat Harris
2003-02-26 19:45 ` Glynn Clements
2003-02-27 10:04 ` Mat Harris
2003-02-27 10:32 ` Mat Harris [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030227103238.A7438@genestate.com \
--to=mat.harris@genestate.com \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).