Specjalistyczne rozwiązania informatyczne

Waitpid causes ENOTBLK error

I had a problem with waitpid. I forked process to execute external application and checked it's result with waitpid:

pid=fork();
if(!pid)
{
  execl("/sbin/hwclock", "hwclock", "--systohc", 0);
  exit(-1);
}
pid=waitpid(pid,&wait_status,0);

Combination above always returned errno = ENOTBLK I didn't find any interesting information about this errno and tracked my source code for relation with forking and getting results from children. I forgot about another waitpid - in SIGCLD signal handler. It removed process zombie and secondary waitpid was executed for non-existent process. That's all.

   © KLASTER 2017