[ProgClub list] Memory management in C

jedd jedd at progclub.org
Sat Oct 1 23:25:54 AEST 2011


On Sat, 2011-10-01 12:44:46 AM John Elliot wrote:
> It's easy to be self-congratulatory when you get a handle on things that 
> everyone says are hard. The thing is, pointers aren't hard!

 Again, context is everything!  :)

 At the time I was ten years younger than you are now, and my
 programming language experience was some self-taught BASIC
 and 65xx assembler, and 12 months of college COBOL.

 But .. I agree.  I don't think they could have been that hard
 or else I wouldn't have been able to understand them.

> 90% of what who needs to know for what? I haven't followed you man.

 90% of what you need to know about C (to learn the language
 proper I mean) could be gained from K&R.  With the earlier caveat
 (analysing other people's code) of course.

 Didn't the second edition of K&R cover ANSI C?  (quick check).  Ahh,
 they were basing it on the ANSI proposal.  

 I suspect I never got into it sufficiently to care about the
 distinctions between the two variants.

> I'm not sure how that would help me. For the administration daemon..? 
> The admin daemon listens on a port for commands and then executes them 
> as a privileged user. Can netcat do that?

 No, probably not.  At least not without some other glue.  Perhaps
 as a method of yakking to the socket - though it'd be a lot less
 fun, and probably just as much work ultimately.

> Yeah, that's cool. I'll setup a pcad user and add it to the sudo group, 
> which will give it the permission it needs to read the particular files 
> I need it to (i.e. the file that contains the password for the MySQL 
> root user). Still, don't you need to supply your password when you 
> invoke sudo? I didn't want to create a user that had to know its password.

 Hmm.  Not sure.  I'd suggest a web search for dropping privileges
 the polite way.  It's not something I've ever done, sorry, so I can't
 offer any insight there.

 If you're thinking about turning this into a .deb you may want to
 consider using the debian-sys-maint account (/etc/mysql/debian.cnf)
 rather than root.  I tend to not use a password on my mysql root
 account on most of my systems (but these are not systems that
 I share with untrusted users).


> Basically user accounts start at 1000, and utility accounts start at 
> 500. That should keep out of the way of the Debian standard users/groups 
> shouldn't it?

 This seems to fit within the Debian policy (section 9.2.2) (refer to
 http://www.debian.org/doc/debian-policy/ch-opersys.html ) though it
 sounds like you should be doing this dynamically on installation
 using adduser --system rather than picking a number and using it
 everywhere.  (Just in case that's what you were thinking of doing.)

 j.


 



More information about the list mailing list