Summary:ASTERISK-09691: [patch] ast_mkdir in place of ast_safe_system("mkdir -p ...")
Reporter:Tilghman Lesher (tilghman)Labels:
Date Opened:2007-06-16 02:34:49Date Closed:2007-06-21 23:34:56
Versions:Frequency of
Environment:Attachments:( 0) 20070617__ast_mkdir.diff.txt
Description:It's faster to do a recursive mkdir in code than to call out to a system command.
Comments:By: Eliel Sardanons (eliel) 2007-06-17 15:07:47

Please correct this:
in ast_mkdir() when you check for an error in mkdir():
if (res && res != EEXIST) should be
if (res && errno != EEXIST)

AND you need to return errno on error if you want this to be done:
    ast_log(LOG_WARNING, "ast_mkdir '%s' failed: %s\n", dest, strerror(res));
cause res at the moment is always -1. So, that if would be:
if (res && errno != EEXIST)
      return errno;

By: Tilghman Lesher (tilghman) 2007-06-17 15:41:03

Good catch.  New patch uploaded.

By: Jason Parker (jparker) 2007-06-19 13:10:38

The patch from 9970 should probably also go in once this does.

By: Eliel Sardanons (eliel) 2007-06-19 13:17:05

I tested 9970 with 9990 and worked fine for me (in app_mixmonitor.c). But Corydon made other code changes that I couldn't test.

By: Jason Parker (jparker) 2007-06-21 16:56:19

Besides the extra stuff in app_sms, this looks good..  I say commit (minus the app_sms atuff)

By: Tilghman Lesher (tilghman) 2007-06-21 23:34:56

Committed revision 71040.