trinity-devel@lists.pearsoncomputing.net

Message: previous - next
Month: January 2012

Re: [trinity-devel] %s, %h variables, etc.

From: /dev/ammo42 <mickeytintincolle@...>
Date: Sat, 21 Jan 2012 20:47:49 +0100
On Sat, 21 Jan 2012 11:42:02 -0800 (PST)
Darrell Anderson <humanreadable@...> wrote:

> > > I still don't where prog is assigned the value of
> > "kdm."
> > In dm.c, line 159. This variable is exported in dm.h, and
> > its value is
> > computed at run-time, for Linux systems (the code is in a
> > "#ifdef
> > __linux__"), as the file pointed by the /proc/self/exe
> > symlink (which
> > always points to the binary of the executable). More
> > precisely,
> > progpath is the full path and prog is the file name of the
> > binary.
> > If kdm was renamed to tdm, it would automagically rename
> > kdm.log to
> > tdm.log.
> 
> Okay, thanks. I'm still too much of newbie with C++ to fully
> understand the syntax and the full bread crumb trail, but I get the
> gist of what is happening.
> 
> Yes, I see that changing kdm to tdm would resolve the bug report in a
> clean manner.
> 
> Tim:
> 
> If you have no objections to renaming Trinity kdm to tdm, would you
> provide me a punch list of sorts for how you proceeded to rename
> kdesu to tdesu?
> 
> If you object to renaming kdm to tdm, then to resolve the bug report
> I think we could resolve with something like this (I'm still learning
> syntax --- need help! :) ):
> 
> // Avoid naming collisions with KDE4.
> char *logname;
> logname = prog;
> strcat ( logname, "-tde" );
> sprintf( buf, "/var/log/%s.log", logname )

sprintf( buf, "/var/log/%s-tde.log", logname );

without the strcat line is better because if you strcat you could cause
a buffer overflow in logname.
Anyway sprintf is potentially insecure, using snprintf would probably be
better.
> 
> Darrell
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> trinity-devel-unsubscribe@... For additional
> commands, e-mail: trinity-devel-help@... Read
> list messsages on the Web archive:
> http://trinity-devel.pearsoncomputing.net/ Please remember not to
> top-post:
> http://trinity.pearsoncomputing.net/mailing_lists/#top-posting
>