On Tue, 4 Oct 2005, Keith Gilman wrote:
> Newbie to Linux trying to set up a webserver with the TS7250. I have
> the server up but I want to be able to read the onboard temperature.
> I'm using the test-cgi script that shipped with the board with the
> following two lines added:
>
> echo UPTIME=`uptime`
> echo TEMP=`./tempSensor' #tempSensor.c downloaded from the TS website
>
> The uptime works as expected but the tempSensor logs the following
> error to the apache error logger:
>
> tempSensor.c:42 main:Assertion 'fd != -1' failed.
>
> The source is:
>
> int fd = open("/dev/mem", O_RDWR);
> assert(fd != -1);
>
It's probably because the web server runs as user nobody as a security
measure. And you'll find that the permissions on /dev/mem are wrong.
2 options
first the bad one...
change permissions on /dev/mem/ to allow anyone to read/write it
not good security
second the not so bad one :-) ......
make your sure your program is owned by root, and executable by all,
and set the setuid bit
chmod +s tempSensor
so when the program is run, it will run AS IF root ran it and so
it will have relevant permissions for accessing /dev/mem
Jim
------------------------ Yahoo! Groups Sponsor --------------------~-->
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/CFFolB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|