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