Changeset 457 for trunk/src/sh_hash.c
- Timestamp:
- Aug 3, 2014, 4:29:51 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sh_hash.c
r444 r457 537 537 SL_RET0(_("hash_unvisited")); 538 538 } 539 539 #if 0 540 if (!strcmp(p->fullpath, "/var/lib/synaptic")) 541 { 542 fprintf(stderr, "FIXME: Check for missing files %s\n", p->fullpath); 543 if (SH_FFLAG_VISITED_SET(p->fflags)) fprintf(stderr, "FIXME: visited\n"); 544 if (SH_FFLAG_CHECKED_SET(p->fflags)) fprintf(stderr, "FIXME: checked\n"); 545 if (SH_FFLAG_REPORTED_SET(p->fflags)) fprintf(stderr, "FIXME: reported\n"); 546 if (SH_FFLAG_ALLIGNORE_SET(p->fflags)) fprintf(stderr, "FIXME: allignore\n"); 547 } 548 #endif 540 549 /* visited flag not set: not seen; 541 550 * checked flag set: not seen (i.e. missing), and already checked … … 551 560 { 552 561 i = retry_lstat(FIL__, __LINE__, p->fullpath, &buf); 553 554 /* if file does not exist 562 #if 0 563 if (!strcmp(p->fullpath, "/var/lib/synaptic")) 564 fprintf(stderr, "FIXME: Check for missing files %s (%d)\n", p->fullpath, i); 565 #endif 566 /* if file does not exist 555 567 */ 556 568 if (0 != i) … … 3817 3829 int i; 3818 3830 3819 SL_ENTER(_(" sh_hash_compdata"));3831 SL_ENTER(_("hash_full_tree")); 3820 3832 3821 3833 if (IsInit != 1) 3822 SL_RETURN(0, _(" sh_hash_compdata"));3834 SL_RETURN(0, _("hash_full_tree")); 3823 3835 3824 3836 SH_MUTEX_LOCK_UNSAFE(mutex_hash); … … 3829 3841 } 3830 3842 SH_MUTEX_UNLOCK_UNSAFE(mutex_hash); 3831 SL_RETURN (0, _(" sh_hash_compdata"));3843 SL_RETURN (0, _("hash_full_tree")); 3832 3844 } 3833 3845 3846 #if !defined(SH_CUTEST) 3847 static 3848 #endif 3849 int hash_remove_tree_test(char * s, char * fullpath, size_t len_s) 3850 { 3851 size_t len_p; 3852 char * test; 3853 3854 len_p = strlen(fullpath); 3855 3856 if (len_p >= len_s) 3857 { 3858 if (0 == strncmp(s, fullpath, len_s)) 3859 { 3860 if (len_p > len_s) 3861 { 3862 /* continue if not inside directory; 3863 * len_s > 1 because everything is inside '/' 3864 */ 3865 if ((len_s > 1) && (fullpath[len_s] != '/')) 3866 return S_FALSE; 3867 3868 test = sh_files_find_mostspecific_dir(fullpath); 3869 3870 if (test && 0 != strcmp(test, s)) { 3871 /* There is a more specific directory, continue */ 3872 return S_FALSE; 3873 } 3874 3875 if (NULL == sh_files_findfile(fullpath)) { 3876 /* SET_SH_FFLAG_ALLIGNORE(p->fflags); */ 3877 return S_TRUE; 3878 } 3879 } 3880 else /* len_p == len */ 3881 { 3882 /* it is 's' itself, mark and continue 3883 * unless there is a policy for the inode itself 3884 */ 3885 if (NULL == sh_files_findfile(fullpath)) { 3886 /* SET_SH_FFLAG_ALLIGNORE(p->fflags); */ 3887 return S_TRUE; 3888 } 3889 else { 3890 return S_FALSE; 3891 } 3892 } 3893 3894 } /* if path is in tree */ 3895 } /* if path is possibly in tree */ 3896 return S_FALSE; 3897 } 3898 3834 3899 3835 3900 int hash_remove_tree (char * s) 3836 3901 { 3837 3902 sh_file_t * p; 3838 size_t len ;3903 size_t len_s; 3839 3904 unsigned int i; 3840 3905 … … 3844 3909 SL_RETURN ((-1), _("hash_remove_tree")); 3845 3910 3846 len = sl_strlen(s);3911 len_s = sl_strlen(s); 3847 3912 3848 3913 if (IsInit != 1) … … 3854 3919 for (p = tab[i]; p; p = p->next) 3855 3920 { 3856 if (p->fullpath && 0 == strncmp(s, p->fullpath, len)) 3857 { 3858 SET_SH_FFLAG_ALLIGNORE(p->fflags); 3859 } 3921 if (p->fullpath) 3922 { 3923 /* if (0 == strncmp(s, p->fullpath, len_s)) *//* old */ 3924 if (S_TRUE == hash_remove_tree_test(s, p->fullpath, len_s)) 3925 SET_SH_FFLAG_ALLIGNORE(p->fflags); 3926 } /* if path is not null */ 3927 3860 3928 } 3861 3929 }
Note:
See TracChangeset
for help on using the changeset viewer.