I'm not sure what you mean? Exec either returns an error, then we enter the if and stop the process, or Exec succeeds, thus replacing the entire process with a new one, so it will never returns. Thus, any call of Exec will have a "doesn't fail" case codepath that "should never be reached".

I just added the printf and exit as a further protection should something go very wrong to make such a failure debuggable.

So, what do you mean, that we should not have the prints?