Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/sh_extern.c

    r29 r1  
    115115  FILE * outf = NULL;
    116116  char * envp[1];
    117   char * argp[2];
     117  char * argp[1];
    118118
    119119  char * errfile;
     
    133133   *         needs a valid *envp[] with envp[0] = NULL;
    134134   *         and similarly for argp
    135    * OpenBSD finally needs non-null argp[0] ...
    136135   */
    137   argp[0] = task->command;
    138   argp[1] = NULL;
    139136  envp[0] = NULL;
     137  argp[0] = NULL;
    140138
    141139  /*
     
    366364             
    367365              PDBGC(5);
    368               sl_snprintf(pname, sizeof(pname), _("/proc/self/fd/%d"), pfd);
    369               if (access(pname, R_OK|X_OK) == 0) /* flawfinder: ignore */
     366              sprintf(pname, _("/proc/self/fd/%d"),      /* known to fit  */
     367                           pfd);
     368              if (access(pname, R_OK|X_OK) == 0)
    370369                {
    371370                  PDBGC(6);
     
    403402           * --  execute path if executable
    404403           */
    405           if (0 == access(task->command, R_OK|X_OK)) /* flawfinder: ignore */
     404          if (0 == access(task->command, R_OK|X_OK))
    406405            {
    407406              PDBGC(5);
     
    545544              task->exit_status = WEXITSTATUS(task->exit_status);
    546545              if ((flag_err_debug == SL_TRUE) || (task->exit_status != 0))
    547                 sl_snprintf(infomsg, sizeof(infomsg),
    548                             _("Subprocess exited normally with status %d"),
    549                             task->exit_status);
     546                sprintf(infomsg,                         /* known to fit  */
     547                        _("Subprocess exited normally with status %d"),
     548                        task->exit_status);
    550549            }
    551550          else if (WIFSIGNALED(task->exit_status) != 0)
    552551            {
    553               sl_snprintf(infomsg, sizeof(infomsg),
    554                           _("Subprocess terminated by signal %d"),
    555                           WTERMSIG(task->exit_status));
     552              sprintf(infomsg,                           /* known to fit  */
     553                      _("Subprocess terminated by signal %d"),
     554                      WTERMSIG(task->exit_status));
    556555              task->exit_status = EXIT_FAILURE;
    557556            }
    558557          else if (WIFSTOPPED(task->exit_status) != 0)
    559558            {
    560               sl_snprintf(infomsg, sizeof(infomsg),
    561                           _("Subprocess stopped by signal %d, killing"),
    562                           WSTOPSIG(task->exit_status));
     559              sprintf(infomsg,                           /* known to fit  */
     560                      _("Subprocess stopped by signal %d, killing"),
     561                      WSTOPSIG(task->exit_status));
    563562              task->exit_status = EXIT_FAILURE;
    564563              (void) aud_kill (FIL__, __LINE__, task->pid, 9);
     
    568567          else
    569568            {
    570               sl_snprintf(infomsg, sizeof(infomsg),
    571                           _("Subprocess exit status unknown"));
     569              sprintf(infomsg,                           /* known to fit  */
     570                      _("Subprocess exit status unknown"));
    572571              task->exit_status = EXIT_FAILURE;
    573572            }
     
    582581            }
    583582          (void) aud_kill (FIL__, __LINE__, task->pid, 9);
    584           sl_snprintf(infomsg, sizeof(infomsg),
    585                       _("Subprocess not yet exited, killing"));
     583          sprintf(infomsg,                               /* known to fit  */
     584                  _("Subprocess not yet exited, killing"));
    586585          task->exit_status = EXIT_FAILURE;
    587586          (void) waitpid (task->pid, NULL, 0);
     
    589588      else
    590589        {
    591           sl_snprintf(infomsg, sizeof(infomsg),
    592                       _("Waitpid returned error %d\n"), errno);
     590          sprintf(infomsg,                               /* known to fit  */
     591                  _("Waitpid returned error %d\n"), errno);
    593592          task->exit_status = EXIT_FAILURE;
    594593        }
     
    647646
    648647
    649 int sh_ext_tas_add_envv(sh_tas_t * tas, const char * key, const char * val)
     648int sh_ext_tas_add_envv(sh_tas_t * tas, char * key, char * val)
    650649{
    651650  size_t sk = 0, sv = 0;
     
    698697}
    699698
    700 int sh_ext_tas_add_argv(sh_tas_t * tas, const char * val)
     699int sh_ext_tas_add_argv(sh_tas_t * tas, char * val)
    701700{
    702701  size_t sv = 0;
     
    723722}
    724723
    725 void sh_ext_tas_command(sh_tas_t * tas, const char * command)
     724void sh_ext_tas_command(sh_tas_t * tas, char * command)
    726725{
    727726  size_t len = sl_strlen(command);
     
    843842
    844843static
    845 int sh_ext_add_envv(const char * key, const char * val)
     844int sh_ext_add_envv(char * key, char * val)
    846845{
    847846  SL_ENTER(_("sh_ext_add_envv"));
     
    862861
    863862static
    864 int sh_ext_init(const char * command)
     863int sh_ext_init(char * command)
    865864{
    866865  sh_com_t * retval;
     
    897896
    898897static
    899 int sh_ext_uid (const char * user, /*@out@*/uid_t * uid, /*@out@*/gid_t * gid)
     898int sh_ext_uid (char * user, /*@out@*/uid_t * uid, /*@out@*/gid_t * gid)
    900899{
    901900  struct passwd * tempres;
     
    923922
    924923static
    925 int sh_ext_add (const char * argstring, int * ntok, char * stok[])
     924int sh_ext_add (char * argstring, int * ntok, char * stok[])
    926925{
    927926  int    i = 0;
    928927  size_t s;
    929928  char * p;
    930   char * new;
    931   size_t len;
    932929
    933930  SL_ENTER(_("sh_ext_add"));
     
    938935    }
    939936
    940   len = strlen(argstring) + 1;
    941   new = SH_ALLOC(len);
    942   sl_strlcpy(new, argstring, len);
    943 
    944937  do
    945938    {
    946939      if (i == 0)
    947         p = strtok (new, ", \t");
     940        p = strtok (argstring, ", \t");
    948941      else
    949942        p = strtok (NULL, ", \t");
     
    964957
    965958  *ntok = i;
    966   SH_FREE(new);
    967959
    968960  SL_RETURN (0, _("sh_ext_add"));
     
    979971 * -- start a new external command, and add it to the list
    980972 */
    981 int sh_ext_setcommand(const char * cmd)
     973int sh_ext_setcommand(char * cmd)
    982974{
    983975  int i;
     
    10261018 * -- add keywords to the OR filter
    10271019 */
    1028 int sh_ext_add_or (const char * str)
     1020int sh_ext_add_or (char * str)
    10291021{
    10301022  if (ext_coms == NULL || ext_failed == (-1))
     
    10361028 * -- add keywords to the AND filter
    10371029 */
    1038 int sh_ext_add_and (const char * str)
     1030int sh_ext_add_and (char * str)
    10391031{
    10401032  if (ext_coms == NULL || ext_failed == (-1))
     
    10461038 * -- add keywords to the NOT filter
    10471039 */
    1048 int sh_ext_add_not (const char * str)
     1040int sh_ext_add_not (char * str)
    10491041{
    10501042  if (ext_coms == NULL || ext_failed == (-1))
     
    10561048 * -- add keywords to the CL argument list
    10571049 */
    1058 int sh_ext_add_argv (const char * str)
     1050int sh_ext_add_argv (char * str)
    10591051{
    10601052  if (ext_coms == NULL || ext_failed == (-1))
     
    10661058 * -- add a path to the environment
    10671059 */
    1068 int sh_ext_add_default (const char * dummy)
    1069 {
    1070   (void) dummy;
    1071   char * p = NULL;
     1060int sh_ext_add_default (char * dummy)
     1061{
     1062  /* while this assignment looks ridiculous, it is here to avoid
     1063   * an 'unused parameter' warning
     1064   */
     1065  char * p = (dummy == NULL ? dummy : NULL);
    10721066  int    i;
    10731067
     
    10901084 * -- add an environment variable
    10911085 */
    1092 int sh_ext_add_environ (const char * str)
     1086int sh_ext_add_environ (char * str)
    10931087{
    10941088  int i;
     
    11011095 * -- set deadtime
    11021096 */
    1103 int sh_ext_deadtime (const char * str)
     1097int sh_ext_deadtime (char * str)
    11041098{
    11051099  long    deadtime = 0;
     
    11251119 * -- define type
    11261120 */
    1127 int sh_ext_type (const char * str)
     1121int sh_ext_type (char * str)
    11281122{
    11291123  SL_ENTER(_("sh_ext_type"));
     
    11601154 * -- define checksum
    11611155 */
    1162 int sh_ext_checksum (const char * str)
     1156int sh_ext_checksum (char * str)
    11631157{
    11641158  SL_ENTER(_("sh_ext_checksum"));
     
    11811175 * -- choose privileges
    11821176 */
    1183 int sh_ext_priv (const char * c)
     1177int sh_ext_priv (char * c)
    11841178{
    11851179
Note: See TracChangeset for help on using the changeset viewer.