Hi, all,

    It seems that  the exec_spawn() will return 0 if fork() fails,  because  
that
                return log_unit_error_errno(params->unit_id, errno, "Failed to 
fork: %m");
 will return -r eventually.  And here r = exec_context_load_environment() , 
which has 
 exited successfully.

   This may lead big trouble to the caller of  exec_spawn().  For example,  
mount_spawn(), which 
also calls exec_spawn(), will not goto fail but run continuelly in this case. 
Then the following unit_watch_pid()
will fail  at assert(pid >= 1);. 

   I also commit a patch to fix this problem, please help to review.
  
  Thanks a lot!

 Li Cheng

  

Attachment: 0001-core-execute-fix-fork-fail-handling-in-exec_spawn.patch
Description: Binary data

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to