Changes in trunk/src/sh_files.c [27:20]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sh_files.c
r27 r20 72 72 #define FIL__ _("sh_files.c") 73 73 74 extern int safe_logger (int signal, int method, pid_t thepid); 75 74 76 extern int flag_err_debug; 75 77 extern int flag_err_info; 76 78 77 int sh_files_reportonce(c onst char * c)79 int sh_files_reportonce(char * c) 78 80 { 79 81 int i; … … 84 86 } 85 87 86 int sh_files_fulldetail(c onst char * c)88 int sh_files_fulldetail(char * c) 87 89 { 88 90 int i; … … 154 156 static int sh_files_fullpath (char * testdir, char * d_name, 155 157 char * statpath); 156 static int sh_files_pushdir (int class, c onst char * str_s);157 static int sh_files_pushfile (int class, c onst char * str_s);158 static int sh_files_pushdir (int class, char * str_s); 159 static int sh_files_pushfile (int class, char * str_s); 158 160 static int sh_files_checkdir (int class, int rdepth, char * dirName, 159 161 char * relativeName); … … 444 446 445 447 446 int sh_files_pushfile_prelink (c onst char * str_s)448 int sh_files_pushfile_prelink (char * str_s) 447 449 { 448 450 return (sh_files_pushfile (SH_LEVEL_PRELINK, str_s)); 449 451 } 450 452 451 int sh_files_pushfile_user0 (c onst char * str_s)453 int sh_files_pushfile_user0 (char * str_s) 452 454 { 453 455 return (sh_files_pushfile (SH_LEVEL_USER0, str_s)); 454 456 } 455 457 456 int sh_files_pushfile_user1 (const char * str_s) 458 459 int sh_files_pushfile_user1 (char * str_s) 457 460 { 458 461 return (sh_files_pushfile (SH_LEVEL_USER1, str_s)); 459 462 } 460 463 461 int sh_files_pushfile_user2 (const char * str_s) 462 { 463 return (sh_files_pushfile (SH_LEVEL_USER2, str_s)); 464 } 465 466 int sh_files_pushfile_user3 (const char * str_s) 467 { 468 return (sh_files_pushfile (SH_LEVEL_USER3, str_s)); 469 } 470 471 int sh_files_pushfile_user4 (const char * str_s) 472 { 473 return (sh_files_pushfile (SH_LEVEL_USER4, str_s)); 474 } 475 476 477 int sh_files_pushfile_ro (const char * str_s) 464 465 int sh_files_pushfile_ro (char * str_s) 478 466 { 479 467 return (sh_files_pushfile (SH_LEVEL_READONLY, str_s)); 480 468 } 481 469 482 int sh_files_pushfile_attr (c onst char * str_s)470 int sh_files_pushfile_attr (char * str_s) 483 471 { 484 472 return (sh_files_pushfile (SH_LEVEL_ATTRIBUTES, str_s)); 485 473 } 486 474 487 int sh_files_pushfile_log (c onst char * str_s)475 int sh_files_pushfile_log (char * str_s) 488 476 { 489 477 return (sh_files_pushfile (SH_LEVEL_LOGFILES, str_s)); 490 478 } 491 479 492 int sh_files_pushfile_glog (c onst char * str_s)480 int sh_files_pushfile_glog (char * str_s) 493 481 { 494 482 return (sh_files_pushfile (SH_LEVEL_LOGGROW, str_s)); 495 483 } 496 484 497 int sh_files_pushfile_noig (c onst char * str_s)485 int sh_files_pushfile_noig (char * str_s) 498 486 { 499 487 return (sh_files_pushfile (SH_LEVEL_NOIGNORE, str_s)); 500 488 } 501 489 502 int sh_files_pushfile_allig (c onst char * str_s)490 int sh_files_pushfile_allig (char * str_s) 503 491 { 504 492 return (sh_files_pushfile (SH_LEVEL_ALLIGNORE, str_s)); … … 523 511 /* set mask(class) 524 512 */ 525 static int sh_files_parse_mask (unsigned long * mask, c onst char * str)513 static int sh_files_parse_mask (unsigned long * mask, char * str) 526 514 { 527 515 int l, i = 0, act = 0, k = 0; … … 614 602 } 615 603 616 int sh_files_redef_prelink(c onst char * str)604 int sh_files_redef_prelink(char * str) 617 605 { 618 606 return (sh_files_parse_mask(&mask_PRELINK, str)); 619 607 } 620 int sh_files_redef_user0(c onst char * str)608 int sh_files_redef_user0(char * str) 621 609 { 622 610 return (sh_files_parse_mask(&mask_USER0, str)); 623 611 } 624 int sh_files_redef_user1(c onst char * str)612 int sh_files_redef_user1(char * str) 625 613 { 626 614 return (sh_files_parse_mask(&mask_USER1, str)); 627 615 } 628 int sh_files_redef_user2(const char * str) 629 { 630 return (sh_files_parse_mask(&mask_USER2, str)); 631 } 632 int sh_files_redef_user3(const char * str) 633 { 634 return (sh_files_parse_mask(&mask_USER3, str)); 635 } 636 int sh_files_redef_user4(const char * str) 637 { 638 return (sh_files_parse_mask(&mask_USER4, str)); 639 } 640 int sh_files_redef_readonly(const char * str) 616 int sh_files_redef_readonly(char * str) 641 617 { 642 618 return (sh_files_parse_mask(&mask_READONLY, str)); 643 619 } 644 int sh_files_redef_loggrow(c onst char * str)620 int sh_files_redef_loggrow(char * str) 645 621 { 646 622 return (sh_files_parse_mask(&mask_LOGGROW, str)); 647 623 } 648 int sh_files_redef_logfiles(c onst char * str)624 int sh_files_redef_logfiles(char * str) 649 625 { 650 626 return (sh_files_parse_mask(&mask_LOGFILES, str)); 651 627 } 652 int sh_files_redef_attributes(c onst char * str)628 int sh_files_redef_attributes(char * str) 653 629 { 654 630 return (sh_files_parse_mask(&mask_ATTRIBUTES, str)); 655 631 } 656 int sh_files_redef_noignore(c onst char * str)632 int sh_files_redef_noignore(char * str) 657 633 { 658 634 return (sh_files_parse_mask(&mask_NOIGNORE, str)); 659 635 } 660 int sh_files_redef_allignore(c onst char * str)636 int sh_files_redef_allignore(char * str) 661 637 { 662 638 return (sh_files_parse_mask(&mask_ALLIGNORE, str)); … … 683 659 case SH_LEVEL_USER1: 684 660 return (unsigned long) mask_USER1; 685 case SH_LEVEL_USER2:686 return (unsigned long) mask_USER2;687 case SH_LEVEL_USER3:688 return (unsigned long) mask_USER3;689 case SH_LEVEL_USER4:690 return (unsigned long) mask_USER4;691 661 case SH_LEVEL_PRELINK: 692 662 return (unsigned long) mask_PRELINK; … … 755 725 if (zfileList == NULL) 756 726 { 757 (void) safe_logger (0, 0, NULL);727 (void) safe_logger (0, 0, getpid()); 758 728 aud__exit(FIL__, __LINE__, EXIT_FAILURE); 759 729 } … … 764 734 if (-1 == ret) 765 735 { 766 (void) safe_logger (0, 0, NULL);736 (void) safe_logger (0, 0, getpid()); 767 737 aud__exit(FIL__, __LINE__, EXIT_FAILURE); 768 738 } … … 775 745 776 746 777 static int sh_files_pushfile (int class, const char * str_s) 778 { 747 static int sh_files_pushfile (int class, char * str_s) 748 { 749 char * tmp; 779 750 int len; 780 char * tmp;781 char * p;782 751 #ifdef HAVE_GLOB_H 752 glob_t pglob; 783 753 int globstatus = -1; 784 754 unsigned int gloop; 785 glob_t pglob;786 755 #endif 787 756 … … 839 808 * special case of the root directory. 840 809 */ 841 p = sh_util_strdup (str_s); 842 if (p[len-1] == '/' && len > 1) 810 if (str_s[len-1] == '/' && len > 1) 843 811 { 844 p[len-1] = '\0';812 str_s[len-1] = '\0'; 845 813 --len; 846 814 } … … 849 817 850 818 #ifdef HAVE_GLOB_H 851 if (0 == sh_files_has_metachar( p))852 { 853 sh_files_push_file_int (class, p, len);819 if (0 == sh_files_has_metachar(str_s)) 820 { 821 sh_files_push_file_int (class, str_s, len); 854 822 } 855 823 else 856 824 { 857 825 pglob.gl_offs = 0; 858 globstatus = glob ( p, 0, sh_files_globerr, &pglob);826 globstatus = glob (str_s, 0, sh_files_globerr, &pglob); 859 827 860 828 if (globstatus == 0 && pglob.gl_pathc > 0) … … 866 834 else 867 835 { 868 tmp = sh_util_safe_name ( p);836 tmp = sh_util_safe_name (str_s); 869 837 870 838 if (pglob.gl_pathc == 0 … … 901 869 902 870 #else 903 sh_files_push_file_int (class, p, len); 904 #endif 905 906 SH_FREE(p); 871 sh_files_push_file_int (class, str_s, len); 872 #endif 873 907 874 SL_RETURN((0),_("sh_files_pushfile")); 908 875 } … … 1061 1028 } 1062 1029 1063 int sh_files_pushdir_prelink (c onst char * str_s)1030 int sh_files_pushdir_prelink (char * str_s) 1064 1031 { 1065 1032 return (sh_files_pushdir (SH_LEVEL_PRELINK, str_s)); 1066 1033 } 1067 1034 1068 int sh_files_pushdir_user0 (c onst char * str_s)1035 int sh_files_pushdir_user0 (char * str_s) 1069 1036 { 1070 1037 return (sh_files_pushdir (SH_LEVEL_USER0, str_s)); 1071 1038 } 1072 1039 1073 int sh_files_pushdir_user1 (c onst char * str_s)1040 int sh_files_pushdir_user1 (char * str_s) 1074 1041 { 1075 1042 return (sh_files_pushdir (SH_LEVEL_USER1, str_s)); 1076 1043 } 1077 1044 1078 int sh_files_pushdir_user2 (const char * str_s) 1079 { 1080 return (sh_files_pushdir (SH_LEVEL_USER2, str_s)); 1081 } 1082 1083 int sh_files_pushdir_user3 (const char * str_s) 1084 { 1085 return (sh_files_pushdir (SH_LEVEL_USER3, str_s)); 1086 } 1087 1088 int sh_files_pushdir_user4 (const char * str_s) 1089 { 1090 return (sh_files_pushdir (SH_LEVEL_USER4, str_s)); 1091 } 1092 1093 int sh_files_pushdir_attr (const char * str_s) 1045 int sh_files_pushdir_attr (char * str_s) 1094 1046 { 1095 1047 return (sh_files_pushdir (SH_LEVEL_ATTRIBUTES, str_s)); 1096 1048 } 1097 1049 1098 int sh_files_pushdir_ro (c onst char * str_s)1050 int sh_files_pushdir_ro (char * str_s) 1099 1051 { 1100 1052 return (sh_files_pushdir (SH_LEVEL_READONLY, str_s)); 1101 1053 } 1102 1054 1103 int sh_files_pushdir_log (c onst char * str_s)1055 int sh_files_pushdir_log (char * str_s) 1104 1056 { 1105 1057 return (sh_files_pushdir (SH_LEVEL_LOGFILES, str_s)); 1106 1058 } 1107 1059 1108 int sh_files_pushdir_glog (c onst char * str_s)1060 int sh_files_pushdir_glog (char * str_s) 1109 1061 { 1110 1062 return (sh_files_pushdir (SH_LEVEL_LOGGROW, str_s)); 1111 1063 } 1112 1064 1113 int sh_files_pushdir_noig (c onst char * str_s)1065 int sh_files_pushdir_noig (char * str_s) 1114 1066 { 1115 1067 return (sh_files_pushdir (SH_LEVEL_NOIGNORE, str_s)); 1116 1068 } 1117 1069 1118 int sh_files_pushdir_allig (c onst char * str_s)1070 int sh_files_pushdir_allig (char * str_s) 1119 1071 { 1120 1072 return (sh_files_pushdir (SH_LEVEL_ALLIGNORE, str_s)); … … 1168 1120 if (tree == NULL) 1169 1121 { 1170 (void) safe_logger (0, 0, NULL);1122 (void) safe_logger (0, 0, getpid()); 1171 1123 aud__exit(FIL__, __LINE__, EXIT_FAILURE); 1172 1124 } … … 1181 1133 if (-1 == ret) 1182 1134 { 1183 (void) safe_logger (0, 0, NULL);1135 (void) safe_logger (0, 0, getpid()); 1184 1136 aud__exit(FIL__, __LINE__, EXIT_FAILURE); 1185 1137 } … … 1191 1143 } 1192 1144 1193 static int sh_files_pushdir (int class, c onst char * str_s)1145 static int sh_files_pushdir (int class, char * str_s) 1194 1146 { 1195 1147 char * tmp; … … 1197 1149 int rdepth = 0; 1198 1150 char * tail = NULL; 1199 char * p;1200 1151 1201 1152 #ifdef HAVE_GLOB_H … … 1215 1166 SL_RETURN((-1), _("sh_files_pushdir")); 1216 1167 1217 p = sh_util_strdup (str_s); 1218 1219 if (p[0] != '/') 1220 { 1221 rdepth = strtol(p, &tail, 10); 1222 if (tail == p) 1223 { 1224 SH_FREE(p); 1225 SL_RETURN((-1), _("sh_files_pushdir")); 1226 } 1168 1169 if (str_s[0] != '/') 1170 { 1171 rdepth = strtol(str_s, &tail, 10); 1172 if (tail == str_s) 1173 SL_RETURN((-1), _("sh_files_pushdir")); 1227 1174 } 1228 1175 else 1229 tail = p;1176 tail = str_s; 1230 1177 1231 1178 1232 if (rdepth < (-1) || tail == p|| rdepth > 99)1179 if (rdepth < (-1) || tail == str_s || rdepth > 99) 1233 1180 rdepth = (-2); 1234 1181 … … 1241 1188 tmp); 1242 1189 SH_FREE(tmp); 1243 SH_FREE(p);1244 1190 SL_RETURN((-1), _("sh_files_pushdir")); 1245 1191 } 1246 1192 else if (len < 1) 1247 1193 { 1248 SH_FREE(p);1249 1194 SL_RETURN((-1), _("sh_files_pushdir")); 1250 1195 } … … 1255 1200 tmp); 1256 1201 SH_FREE(tmp); 1257 SH_FREE(p);1258 1202 SL_RETURN((-1), _("sh_files_pushdir")); 1259 1203 } … … 1324 1268 #endif 1325 1269 1326 SH_FREE(p);1327 1270 SL_RETURN((0), _("sh_files_pushdir")); 1328 1271 } … … 1379 1322 /* Simply sets our boolean as to whether this check is active 1380 1323 */ 1381 int sh_files_check_hardlinks (c onst char * opt)1324 int sh_files_check_hardlinks (char * opt) 1382 1325 { 1383 1326 int i; … … 1395 1338 static struct sh_hle_struct * sh_hl_exc = NULL; 1396 1339 1397 int sh_files_hle_reg (c onst char * str)1340 int sh_files_hle_reg (char * str) 1398 1341 { 1399 1342 long offset;
Note:
See TracChangeset
for help on using the changeset viewer.