Published February 4th, 2005

Read some scary code in Asterisk today:

Quote from Asterisk:

static void huphandler(int num)
if (option
verbose > 1) printf(“Received HUP signal — Reloading configs\n”); if (restartnow) execvp(argv[0], _argv); /* XXX This could deadlock XXX */

  1. printf should not be used in a signal. handler.
  1. Calling execvp here is completely bogus. Signals can come at any time, and Asterisk is a multithreaded program. The signal will be handled by a random thread, and this will not do any cleanup of the resources used by asterisk.

Written by Paul Querna, CTO @ ScaleFT. @pquerna