I'm new to this forum and I would like to ask the experts a question. I wrote the following program ( part of a bigger thing, but this is the code that causes me trouble)
#include <unistd.h>
#include <fcntl.h>
int main()
{
int fd;
fd = open("/dev/watchdog",O_RDONLY);
lseek(fd,0,SEEK_END);
return 0;
}
The thing that bothers me is that after I run this program as root, after 20-30 seconds, the system crashes, and I can't seem to figure out why. This does not happend as a regular user. Could you please enlighten me regarding this issue?
Thanks!
PS. Yes, I know that /dev/watchdog is a character file and it's not seekable, but this seems really weird.