|
From: Kamil I. <ac...@wp...> - 2014-01-02 22:03:15
|
On 02.01.2014 05:36, Roger wrote: > Reading further into LDPI book on system(), seems using system() for secure > set-user-id & set-group-id programs is bad, and should resort to fork() and one > of the exec() -- other then execlp() and execvp() - directly. > > cdw uses exec*() since forever. It has been tested with various external tools and commands in different situations, and it works well. Replacing the exec*() with system() would require a lot of additional testing, and this is something that I would rather want to avoid. I think that I will go with adding waitpid(.... int *status, ...) to already existing fork() & exec*(). I see that I already call wait() in cleanup code after child process exits (cdw_sys.c), so I guess I can replace wait() with waitpid() and move the call to waitpid() to some more appropriate place. The whole forking and spawning new processes thing was never *very* important to me in cdw. Once I verified that this piece of code worked as expected, I totally forgot about it and focused on handling and parsing stdout and sterr streams from cdrecord, mkisofs & co. Maybe it's time to revisit cdw_thread.c and cdw_sys.c :) Best regards, Kamil |