Changes in trunk/src/sh_extern.c [29:1]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sh_extern.c
r29 r1 115 115 FILE * outf = NULL; 116 116 char * envp[1]; 117 char * argp[ 2];117 char * argp[1]; 118 118 119 119 char * errfile; … … 133 133 * needs a valid *envp[] with envp[0] = NULL; 134 134 * and similarly for argp 135 * OpenBSD finally needs non-null argp[0] ...136 135 */ 137 argp[0] = task->command;138 argp[1] = NULL;139 136 envp[0] = NULL; 137 argp[0] = NULL; 140 138 141 139 /* … … 366 364 367 365 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) 370 369 { 371 370 PDBGC(6); … … 403 402 * -- execute path if executable 404 403 */ 405 if (0 == access(task->command, R_OK|X_OK)) /* flawfinder: ignore */404 if (0 == access(task->command, R_OK|X_OK)) 406 405 { 407 406 PDBGC(5); … … 545 544 task->exit_status = WEXITSTATUS(task->exit_status); 546 545 if ((flag_err_debug == SL_TRUE) || (task->exit_status != 0)) 547 s l_snprintf(infomsg, sizeof(infomsg),548 549 546 sprintf(infomsg, /* known to fit */ 547 _("Subprocess exited normally with status %d"), 548 task->exit_status); 550 549 } 551 550 else if (WIFSIGNALED(task->exit_status) != 0) 552 551 { 553 s l_snprintf(infomsg, sizeof(infomsg),554 555 552 sprintf(infomsg, /* known to fit */ 553 _("Subprocess terminated by signal %d"), 554 WTERMSIG(task->exit_status)); 556 555 task->exit_status = EXIT_FAILURE; 557 556 } 558 557 else if (WIFSTOPPED(task->exit_status) != 0) 559 558 { 560 s l_snprintf(infomsg, sizeof(infomsg),561 562 559 sprintf(infomsg, /* known to fit */ 560 _("Subprocess stopped by signal %d, killing"), 561 WSTOPSIG(task->exit_status)); 563 562 task->exit_status = EXIT_FAILURE; 564 563 (void) aud_kill (FIL__, __LINE__, task->pid, 9); … … 568 567 else 569 568 { 570 s l_snprintf(infomsg, sizeof(infomsg),571 569 sprintf(infomsg, /* known to fit */ 570 _("Subprocess exit status unknown")); 572 571 task->exit_status = EXIT_FAILURE; 573 572 } … … 582 581 } 583 582 (void) aud_kill (FIL__, __LINE__, task->pid, 9); 584 s l_snprintf(infomsg, sizeof(infomsg),585 583 sprintf(infomsg, /* known to fit */ 584 _("Subprocess not yet exited, killing")); 586 585 task->exit_status = EXIT_FAILURE; 587 586 (void) waitpid (task->pid, NULL, 0); … … 589 588 else 590 589 { 591 s l_snprintf(infomsg, sizeof(infomsg),592 590 sprintf(infomsg, /* known to fit */ 591 _("Waitpid returned error %d\n"), errno); 593 592 task->exit_status = EXIT_FAILURE; 594 593 } … … 647 646 648 647 649 int sh_ext_tas_add_envv(sh_tas_t * tas, c onst char * key, constchar * val)648 int sh_ext_tas_add_envv(sh_tas_t * tas, char * key, char * val) 650 649 { 651 650 size_t sk = 0, sv = 0; … … 698 697 } 699 698 700 int sh_ext_tas_add_argv(sh_tas_t * tas, c onst char * val)699 int sh_ext_tas_add_argv(sh_tas_t * tas, char * val) 701 700 { 702 701 size_t sv = 0; … … 723 722 } 724 723 725 void sh_ext_tas_command(sh_tas_t * tas, c onst char * command)724 void sh_ext_tas_command(sh_tas_t * tas, char * command) 726 725 { 727 726 size_t len = sl_strlen(command); … … 843 842 844 843 static 845 int sh_ext_add_envv(c onst char * key, constchar * val)844 int sh_ext_add_envv(char * key, char * val) 846 845 { 847 846 SL_ENTER(_("sh_ext_add_envv")); … … 862 861 863 862 static 864 int sh_ext_init(c onst char * command)863 int sh_ext_init(char * command) 865 864 { 866 865 sh_com_t * retval; … … 897 896 898 897 static 899 int sh_ext_uid (c onst char * user, /*@out@*/uid_t * uid, /*@out@*/gid_t * gid)898 int sh_ext_uid (char * user, /*@out@*/uid_t * uid, /*@out@*/gid_t * gid) 900 899 { 901 900 struct passwd * tempres; … … 923 922 924 923 static 925 int sh_ext_add (c onst char * argstring, int * ntok, char * stok[])924 int sh_ext_add (char * argstring, int * ntok, char * stok[]) 926 925 { 927 926 int i = 0; 928 927 size_t s; 929 928 char * p; 930 char * new;931 size_t len;932 929 933 930 SL_ENTER(_("sh_ext_add")); … … 938 935 } 939 936 940 len = strlen(argstring) + 1;941 new = SH_ALLOC(len);942 sl_strlcpy(new, argstring, len);943 944 937 do 945 938 { 946 939 if (i == 0) 947 p = strtok ( new, ", \t");940 p = strtok (argstring, ", \t"); 948 941 else 949 942 p = strtok (NULL, ", \t"); … … 964 957 965 958 *ntok = i; 966 SH_FREE(new);967 959 968 960 SL_RETURN (0, _("sh_ext_add")); … … 979 971 * -- start a new external command, and add it to the list 980 972 */ 981 int sh_ext_setcommand(c onst char * cmd)973 int sh_ext_setcommand(char * cmd) 982 974 { 983 975 int i; … … 1026 1018 * -- add keywords to the OR filter 1027 1019 */ 1028 int sh_ext_add_or (c onst char * str)1020 int sh_ext_add_or (char * str) 1029 1021 { 1030 1022 if (ext_coms == NULL || ext_failed == (-1)) … … 1036 1028 * -- add keywords to the AND filter 1037 1029 */ 1038 int sh_ext_add_and (c onst char * str)1030 int sh_ext_add_and (char * str) 1039 1031 { 1040 1032 if (ext_coms == NULL || ext_failed == (-1)) … … 1046 1038 * -- add keywords to the NOT filter 1047 1039 */ 1048 int sh_ext_add_not (c onst char * str)1040 int sh_ext_add_not (char * str) 1049 1041 { 1050 1042 if (ext_coms == NULL || ext_failed == (-1)) … … 1056 1048 * -- add keywords to the CL argument list 1057 1049 */ 1058 int sh_ext_add_argv (c onst char * str)1050 int sh_ext_add_argv (char * str) 1059 1051 { 1060 1052 if (ext_coms == NULL || ext_failed == (-1)) … … 1066 1058 * -- add a path to the environment 1067 1059 */ 1068 int sh_ext_add_default (const char * dummy) 1069 { 1070 (void) dummy; 1071 char * p = NULL; 1060 int 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); 1072 1066 int i; 1073 1067 … … 1090 1084 * -- add an environment variable 1091 1085 */ 1092 int sh_ext_add_environ (c onst char * str)1086 int sh_ext_add_environ (char * str) 1093 1087 { 1094 1088 int i; … … 1101 1095 * -- set deadtime 1102 1096 */ 1103 int sh_ext_deadtime (c onst char * str)1097 int sh_ext_deadtime (char * str) 1104 1098 { 1105 1099 long deadtime = 0; … … 1125 1119 * -- define type 1126 1120 */ 1127 int sh_ext_type (c onst char * str)1121 int sh_ext_type (char * str) 1128 1122 { 1129 1123 SL_ENTER(_("sh_ext_type")); … … 1160 1154 * -- define checksum 1161 1155 */ 1162 int sh_ext_checksum (c onst char * str)1156 int sh_ext_checksum (char * str) 1163 1157 { 1164 1158 SL_ENTER(_("sh_ext_checksum")); … … 1181 1175 * -- choose privileges 1182 1176 */ 1183 int sh_ext_priv (c onst char * c)1177 int sh_ext_priv (char * c) 1184 1178 { 1185 1179
Note:
See TracChangeset
for help on using the changeset viewer.