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