pike.git / src / builtin_functions.c

version» Context lines:

pike.git/src/builtin_functions.c:1:   /*\   ||| This file a part of Pike, and is copyright by Fredrik Hubinette   ||| Pike is distributed as GPL (General Public License)   ||| See the files COPYING and DISCLAIMER for more information.   \*/   /**/   #include "global.h" - RCSID("$Id: builtin_functions.c,v 1.369 2003/09/19 12:28:52 jonasw Exp $"); + RCSID("$Id$");   #include "interpret.h"   #include "svalue.h"   #include "pike_macros.h"   #include "object.h"   #include "program.h"   #include "array.h"   #include "pike_error.h"   #include "constants.h"   #include "mapping.h"   #include "stralloc.h"
pike.git/src/builtin_functions.c:2221:    if(Pike_sp[1-args].type != T_STRING ||    Pike_sp[1-args].u.string->len < 2)    {    pop_n_elems(args);    push_int(0);    return;    }       saltp=Pike_sp[1-args].u.string->str;    } else { -  unsigned int foo; /* Sun CC want's this :( */ +  unsigned int foo; /* Sun CC wants this :( */    foo=my_rand();    salt[0] = choise[foo % (size_t) strlen(choise)];    foo=my_rand();    salt[1] = choise[foo % (size_t) strlen(choise)];    saltp=salt;    }   #ifdef HAVE_CRYPT    ret = (char *)crypt(Pike_sp[-args].u.string->str, saltp);   #else   #ifdef HAVE__CRYPT    ret = (char *)_crypt(Pike_sp[-args].u.string->str, saltp);   #else    ret = Pike_sp[-args].u.string->str;   #endif   #endif -  +  if (!ret) { +  switch(errno) { + #ifdef ELIBACC +  case ELIBACC: +  Pike_error("Failed to load a required shared library. " +  "Unsupported salt.\n"); +  break; + #endif +  case ENOMEM: +  Pike_error("Out of memory.\n"); +  break; +  case EINVAL: +  default: +  Pike_error("Unsupported salt (%d).\n", errno); +  break; +  } +  }    if(args < 2)    {    pop_n_elems(args);    push_string(make_shared_string(ret));    }else{    int i;    i=!strcmp(ret,Pike_sp[1-args].u.string->str);    pop_n_elems(args);    push_int(i);    }