reopen 553643
thanks

switching from "pidof powersaved" to "pidof /usr/sbin/powersaved"
doesn't really resolve the problem, though.  The attached program
renames itself so that it shows up in the output of "pidof
/usr/sbin/powersaved" as well.

I suspect pidof might not be the right way to find out if powersaved is
really running.  perhaps powersaved has an interface you could query?

hrm.  looking into it further, it appears that powersaved has been
dropped from debian, so this particular instance could be resolved even
more easily for the upcoming release:

http://packages.qa.debian.org/p/powersave/news/20091218T132117Z.html

But in general, the message stands: please don't hinge critical system
decisions on the output of pidof like this.  it's way too easy to
manipulate.

        --dkg
#include <unistd.h>
#include <string.h>

/* 

   Author: Daniel Kahn Gillmor <d...@fifthhorseman.net> 
   This is is relevant to http://bugs.debian.org/553643

   Call the resultant program with some long garbage argument so that
   the strcpy here doesn't overwrite things.

*/

int main(int argc, char* argv[]) {
  strcpy(argv[0], "/usr/sbin/powersaved");
  sleep(10);
  return 0;
}

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to