Changeset 22 for trunk/src/sh_files.c
- Timestamp:
- Feb 23, 2006, 12:03:58 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sh_files.c
r20 r22 72 72 #define FIL__ _("sh_files.c") 73 73 74 extern int safe_logger (int signal, int method, pid_t thepid);75 76 74 extern int flag_err_debug; 77 75 extern int flag_err_info; 78 76 79 int sh_files_reportonce(c har * c)77 int sh_files_reportonce(const char * c) 80 78 { 81 79 int i; … … 86 84 } 87 85 88 int sh_files_fulldetail(c har * c)86 int sh_files_fulldetail(const char * c) 89 87 { 90 88 int i; … … 156 154 static int sh_files_fullpath (char * testdir, char * d_name, 157 155 char * statpath); 158 static int sh_files_pushdir (int class, c har * str_s);159 static int sh_files_pushfile (int class, c har * str_s);156 static int sh_files_pushdir (int class, const char * str_s); 157 static int sh_files_pushfile (int class, const char * str_s); 160 158 static int sh_files_checkdir (int class, int rdepth, char * dirName, 161 159 char * relativeName); … … 446 444 447 445 448 int sh_files_pushfile_prelink (c har * str_s)446 int sh_files_pushfile_prelink (const char * str_s) 449 447 { 450 448 return (sh_files_pushfile (SH_LEVEL_PRELINK, str_s)); 451 449 } 452 450 453 int sh_files_pushfile_user0 (c har * str_s)451 int sh_files_pushfile_user0 (const char * str_s) 454 452 { 455 453 return (sh_files_pushfile (SH_LEVEL_USER0, str_s)); … … 457 455 458 456 459 int sh_files_pushfile_user1 (c har * str_s)457 int sh_files_pushfile_user1 (const char * str_s) 460 458 { 461 459 return (sh_files_pushfile (SH_LEVEL_USER1, str_s)); … … 463 461 464 462 465 int sh_files_pushfile_ro (c har * str_s)463 int sh_files_pushfile_ro (const char * str_s) 466 464 { 467 465 return (sh_files_pushfile (SH_LEVEL_READONLY, str_s)); 468 466 } 469 467 470 int sh_files_pushfile_attr (c har * str_s)468 int sh_files_pushfile_attr (const char * str_s) 471 469 { 472 470 return (sh_files_pushfile (SH_LEVEL_ATTRIBUTES, str_s)); 473 471 } 474 472 475 int sh_files_pushfile_log (c har * str_s)473 int sh_files_pushfile_log (const char * str_s) 476 474 { 477 475 return (sh_files_pushfile (SH_LEVEL_LOGFILES, str_s)); 478 476 } 479 477 480 int sh_files_pushfile_glog (c har * str_s)478 int sh_files_pushfile_glog (const char * str_s) 481 479 { 482 480 return (sh_files_pushfile (SH_LEVEL_LOGGROW, str_s)); 483 481 } 484 482 485 int sh_files_pushfile_noig (c har * str_s)483 int sh_files_pushfile_noig (const char * str_s) 486 484 { 487 485 return (sh_files_pushfile (SH_LEVEL_NOIGNORE, str_s)); 488 486 } 489 487 490 int sh_files_pushfile_allig (c har * str_s)488 int sh_files_pushfile_allig (const char * str_s) 491 489 { 492 490 return (sh_files_pushfile (SH_LEVEL_ALLIGNORE, str_s)); … … 511 509 /* set mask(class) 512 510 */ 513 static int sh_files_parse_mask (unsigned long * mask, c har * str)511 static int sh_files_parse_mask (unsigned long * mask, const char * str) 514 512 { 515 513 int l, i = 0, act = 0, k = 0; … … 602 600 } 603 601 604 int sh_files_redef_prelink(c har * str)602 int sh_files_redef_prelink(const char * str) 605 603 { 606 604 return (sh_files_parse_mask(&mask_PRELINK, str)); 607 605 } 608 int sh_files_redef_user0(c har * str)606 int sh_files_redef_user0(const char * str) 609 607 { 610 608 return (sh_files_parse_mask(&mask_USER0, str)); 611 609 } 612 int sh_files_redef_user1(c har * str)610 int sh_files_redef_user1(const char * str) 613 611 { 614 612 return (sh_files_parse_mask(&mask_USER1, str)); 615 613 } 616 int sh_files_redef_readonly(c har * str)614 int sh_files_redef_readonly(const char * str) 617 615 { 618 616 return (sh_files_parse_mask(&mask_READONLY, str)); 619 617 } 620 int sh_files_redef_loggrow(c har * str)618 int sh_files_redef_loggrow(const char * str) 621 619 { 622 620 return (sh_files_parse_mask(&mask_LOGGROW, str)); 623 621 } 624 int sh_files_redef_logfiles(c har * str)622 int sh_files_redef_logfiles(const char * str) 625 623 { 626 624 return (sh_files_parse_mask(&mask_LOGFILES, str)); 627 625 } 628 int sh_files_redef_attributes(c har * str)626 int sh_files_redef_attributes(const char * str) 629 627 { 630 628 return (sh_files_parse_mask(&mask_ATTRIBUTES, str)); 631 629 } 632 int sh_files_redef_noignore(c har * str)630 int sh_files_redef_noignore(const char * str) 633 631 { 634 632 return (sh_files_parse_mask(&mask_NOIGNORE, str)); 635 633 } 636 int sh_files_redef_allignore(c har * str)634 int sh_files_redef_allignore(const char * str) 637 635 { 638 636 return (sh_files_parse_mask(&mask_ALLIGNORE, str)); … … 725 723 if (zfileList == NULL) 726 724 { 727 (void) safe_logger (0, 0, getpid());725 (void) safe_logger (0, 0, NULL); 728 726 aud__exit(FIL__, __LINE__, EXIT_FAILURE); 729 727 } … … 734 732 if (-1 == ret) 735 733 { 736 (void) safe_logger (0, 0, getpid());734 (void) safe_logger (0, 0, NULL); 737 735 aud__exit(FIL__, __LINE__, EXIT_FAILURE); 738 736 } … … 745 743 746 744 747 static int sh_files_pushfile (int class, char * str_s) 748 { 745 static int sh_files_pushfile (int class, const char * str_s) 746 { 747 int len; 749 748 char * tmp; 750 int len;749 char * p; 751 750 #ifdef HAVE_GLOB_H 752 glob_t pglob;753 751 int globstatus = -1; 754 752 unsigned int gloop; 753 glob_t pglob; 755 754 #endif 756 755 … … 808 807 * special case of the root directory. 809 808 */ 810 if (str_s[len-1] == '/' && len > 1) 809 p = sh_util_strdup (str_s); 810 if (p[len-1] == '/' && len > 1) 811 811 { 812 str_s[len-1] = '\0';812 p[len-1] = '\0'; 813 813 --len; 814 814 } … … 817 817 818 818 #ifdef HAVE_GLOB_H 819 if (0 == sh_files_has_metachar( str_s))820 { 821 sh_files_push_file_int (class, str_s, len);819 if (0 == sh_files_has_metachar(p)) 820 { 821 sh_files_push_file_int (class, p, len); 822 822 } 823 823 else 824 824 { 825 825 pglob.gl_offs = 0; 826 globstatus = glob ( str_s, 0, sh_files_globerr, &pglob);826 globstatus = glob (p, 0, sh_files_globerr, &pglob); 827 827 828 828 if (globstatus == 0 && pglob.gl_pathc > 0) … … 834 834 else 835 835 { 836 tmp = sh_util_safe_name ( str_s);836 tmp = sh_util_safe_name (p); 837 837 838 838 if (pglob.gl_pathc == 0 … … 869 869 870 870 #else 871 sh_files_push_file_int (class, str_s, len); 872 #endif 873 871 sh_files_push_file_int (class, p, len); 872 #endif 873 874 SH_FREE(p); 874 875 SL_RETURN((0),_("sh_files_pushfile")); 875 876 } … … 1028 1029 } 1029 1030 1030 int sh_files_pushdir_prelink (c har * str_s)1031 int sh_files_pushdir_prelink (const char * str_s) 1031 1032 { 1032 1033 return (sh_files_pushdir (SH_LEVEL_PRELINK, str_s)); 1033 1034 } 1034 1035 1035 int sh_files_pushdir_user0 (c har * str_s)1036 int sh_files_pushdir_user0 (const char * str_s) 1036 1037 { 1037 1038 return (sh_files_pushdir (SH_LEVEL_USER0, str_s)); 1038 1039 } 1039 1040 1040 int sh_files_pushdir_user1 (c har * str_s)1041 int sh_files_pushdir_user1 (const char * str_s) 1041 1042 { 1042 1043 return (sh_files_pushdir (SH_LEVEL_USER1, str_s)); 1043 1044 } 1044 1045 1045 int sh_files_pushdir_attr (c har * str_s)1046 int sh_files_pushdir_attr (const char * str_s) 1046 1047 { 1047 1048 return (sh_files_pushdir (SH_LEVEL_ATTRIBUTES, str_s)); 1048 1049 } 1049 1050 1050 int sh_files_pushdir_ro (c har * str_s)1051 int sh_files_pushdir_ro (const char * str_s) 1051 1052 { 1052 1053 return (sh_files_pushdir (SH_LEVEL_READONLY, str_s)); 1053 1054 } 1054 1055 1055 int sh_files_pushdir_log (c har * str_s)1056 int sh_files_pushdir_log (const char * str_s) 1056 1057 { 1057 1058 return (sh_files_pushdir (SH_LEVEL_LOGFILES, str_s)); 1058 1059 } 1059 1060 1060 int sh_files_pushdir_glog (c har * str_s)1061 int sh_files_pushdir_glog (const char * str_s) 1061 1062 { 1062 1063 return (sh_files_pushdir (SH_LEVEL_LOGGROW, str_s)); 1063 1064 } 1064 1065 1065 int sh_files_pushdir_noig (c har * str_s)1066 int sh_files_pushdir_noig (const char * str_s) 1066 1067 { 1067 1068 return (sh_files_pushdir (SH_LEVEL_NOIGNORE, str_s)); 1068 1069 } 1069 1070 1070 int sh_files_pushdir_allig (c har * str_s)1071 int sh_files_pushdir_allig (const char * str_s) 1071 1072 { 1072 1073 return (sh_files_pushdir (SH_LEVEL_ALLIGNORE, str_s)); … … 1120 1121 if (tree == NULL) 1121 1122 { 1122 (void) safe_logger (0, 0, getpid());1123 (void) safe_logger (0, 0, NULL); 1123 1124 aud__exit(FIL__, __LINE__, EXIT_FAILURE); 1124 1125 } … … 1133 1134 if (-1 == ret) 1134 1135 { 1135 (void) safe_logger (0, 0, getpid());1136 (void) safe_logger (0, 0, NULL); 1136 1137 aud__exit(FIL__, __LINE__, EXIT_FAILURE); 1137 1138 } … … 1143 1144 } 1144 1145 1145 static int sh_files_pushdir (int class, c har * str_s)1146 static int sh_files_pushdir (int class, const char * str_s) 1146 1147 { 1147 1148 char * tmp; … … 1149 1150 int rdepth = 0; 1150 1151 char * tail = NULL; 1152 char * p; 1151 1153 1152 1154 #ifdef HAVE_GLOB_H … … 1166 1168 SL_RETURN((-1), _("sh_files_pushdir")); 1167 1169 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")); 1170 p = sh_util_strdup (str_s); 1171 1172 if (p[0] != '/') 1173 { 1174 rdepth = strtol(p, &tail, 10); 1175 if (tail == p) 1176 { 1177 SH_FREE(p); 1178 SL_RETURN((-1), _("sh_files_pushdir")); 1179 } 1174 1180 } 1175 1181 else 1176 tail = str_s;1182 tail = p; 1177 1183 1178 1184 1179 if (rdepth < (-1) || tail == str_s|| rdepth > 99)1185 if (rdepth < (-1) || tail == p || rdepth > 99) 1180 1186 rdepth = (-2); 1181 1187 … … 1188 1194 tmp); 1189 1195 SH_FREE(tmp); 1196 SH_FREE(p); 1190 1197 SL_RETURN((-1), _("sh_files_pushdir")); 1191 1198 } 1192 1199 else if (len < 1) 1193 1200 { 1201 SH_FREE(p); 1194 1202 SL_RETURN((-1), _("sh_files_pushdir")); 1195 1203 } … … 1200 1208 tmp); 1201 1209 SH_FREE(tmp); 1210 SH_FREE(p); 1202 1211 SL_RETURN((-1), _("sh_files_pushdir")); 1203 1212 } … … 1268 1277 #endif 1269 1278 1279 SH_FREE(p); 1270 1280 SL_RETURN((0), _("sh_files_pushdir")); 1271 1281 } … … 1322 1332 /* Simply sets our boolean as to whether this check is active 1323 1333 */ 1324 int sh_files_check_hardlinks (c har * opt)1334 int sh_files_check_hardlinks (const char * opt) 1325 1335 { 1326 1336 int i; … … 1338 1348 static struct sh_hle_struct * sh_hl_exc = NULL; 1339 1349 1340 int sh_files_hle_reg (c har * str)1350 int sh_files_hle_reg (const char * str) 1341 1351 { 1342 1352 long offset;
Note:
See TracChangeset
for help on using the changeset viewer.