Line data Source code
1 : /*
2 : Bacula® - The Network Backup Solution
3 :
4 : Copyright (C) 2000-2010 Free Software Foundation Europe e.V.
5 :
6 : The main author of Bacula is Kern Sibbald, with contributions from
7 : many others, a complete list can be found in the file AUTHORS.
8 : This program is Free Software; you can redistribute it and/or
9 : modify it under the terms of version three of the GNU Affero General Public
10 : License as published by the Free Software Foundation and included
11 : in the file LICENSE.
12 :
13 : This program is distributed in the hope that it will be useful, but
14 : WITHOUT ANY WARRANTY; without even the implied warranty of
15 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 : General Public License for more details.
17 :
18 : You should have received a copy of the GNU Affero General Public License
19 : along with this program; if not, write to the Free Software
20 : Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 : 02110-1301, USA.
22 :
23 : Bacula® is a registered trademark of Kern Sibbald.
24 : The licensor of Bacula is the Free Software Foundation Europe
25 : (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
26 : Switzerland, email:ftf@fsfeurope.org.
27 : */
28 : /*
29 : This file was derived from GNU TAR source code. Except for a few key
30 : ideas, it has been entirely rewritten for Bacula.
31 :
32 : Kern Sibbald, MM
33 :
34 : Thanks to the TAR programmers.
35 : */
36 : /*
37 : This file was derived from the findlib code from bacula-5.0.3, and
38 : heavily modified. Therefore, I have retained the bacula copyright notice.
39 : The specific bacula files were:
40 : src/findlib/find.c
41 : src/findlib/find_one.c.
42 : The comment by Kern above, about TAR, was from find_one.c.
43 :
44 : Graham Keeling, 2014.
45 : */
46 :
47 : #include "../burp.h"
48 : #include "../alloc.h"
49 : #include "../conf.h"
50 : #include "../fsops.h"
51 : #include "../linkhash.h"
52 : #include "../log.h"
53 : #include "../pathcmp.h"
54 : #include "../prepend.h"
55 : #include "../regexp.h"
56 : #include "../strlist.h"
57 : #include "find.h"
58 :
59 : #ifdef HAVE_LINUX_OS
60 : #include <sys/statfs.h>
61 : #endif
62 :
63 : static int (*send_file)(struct asfd *, struct FF_PKT *, struct conf **);
64 :
65 : // Initialize the find files "global" variables
66 13 : struct FF_PKT *find_files_init(
67 : int callback(struct asfd *asfd, struct FF_PKT *ff, struct conf **confs))
68 : {
69 : struct FF_PKT *ff;
70 :
71 13 : if(!(ff=(struct FF_PKT *)calloc_w(1, sizeof(struct FF_PKT), __func__))
72 13 : || linkhash_init())
73 : return NULL;
74 13 : send_file=callback;
75 :
76 13 : return ff;
77 : }
78 :
79 13 : void find_files_free(struct FF_PKT **ff)
80 : {
81 13 : linkhash_free();
82 13 : free_v((void **)ff);
83 13 : }
84 :
85 : // Return 1 to include the file, 0 to exclude it.
86 52 : static int in_include_ext(struct strlist *incext, const char *fname)
87 : {
88 52 : int i=0;
89 : struct strlist *l;
90 52 : const char *cp=NULL;
91 : // If not doing include_ext, let the file get backed up.
92 52 : if(!incext) return 1;
93 :
94 : // The flag of the first item contains the maximum number of characters
95 : // that need to be checked.
96 : // FIX THIS: The next two functions do things very similar to this.
97 32 : for(cp=fname+strlen(fname)-1; i<incext->flag && cp>=fname; cp--, i++)
98 : {
99 14 : if(*cp!='.') continue;
100 3 : for(l=incext; l; l=l->next)
101 7 : if(!strcasecmp(l->path, cp+1))
102 : return 1;
103 : // If file has no extension, it cannot be included.
104 : return 0;
105 : }
106 : return 0;
107 : }
108 :
109 128 : static int in_exclude_ext(struct strlist *excext, const char *fname)
110 : {
111 128 : int i=0;
112 : struct strlist *l;
113 128 : const char *cp=NULL;
114 : // If not doing exclude_ext, let the file get backed up.
115 128 : if(!excext) return 0;
116 :
117 : // The flag of the first item contains the maximum number of characters
118 : // that need to be checked.
119 50 : for(cp=fname+strlen(fname)-1; i<excext->flag && cp>=fname; cp--, i++)
120 : {
121 20 : if(*cp!='.') continue;
122 5 : for(l=excext; l; l=l->next)
123 8 : if(!strcasecmp(l->path, cp+1))
124 : return 1;
125 : // If file has no extension, it is included.
126 : return 0;
127 : }
128 : return 0;
129 : }
130 :
131 : // Returns the level of compression.
132 8 : int in_exclude_comp(struct strlist *excom, const char *fname, int compression)
133 : {
134 8 : int i=0;
135 : struct strlist *l;
136 8 : const char *cp=NULL;
137 : // If not doing compression, or there are no excludes, return
138 : // straight away.
139 8 : if(!compression || !excom) return compression;
140 :
141 : // The flag of the first item contains the maximum number of characters
142 : // that need to be checked.
143 0 : for(cp=fname+strlen(fname)-1; i<excom->flag && cp>=fname; cp--, i++)
144 : {
145 0 : if(*cp!='.') continue;
146 0 : for(l=excom; l; l=l->next)
147 0 : if(!strcasecmp(l->path, cp+1))
148 : return 0;
149 : return compression;
150 : }
151 : return compression;
152 : }
153 :
154 : /* Return 1 to include the file, 0 to exclude it. */
155 : /* Currently not used - it needs more thinking about. */
156 : /*
157 : int in_include_regex(struct strlist *increg, const char *fname)
158 : {
159 : // If not doing include_regex, let the file get backed up.
160 : if(!increg) return 1;
161 : for(; increg; increg=increg->next)
162 : if(regex_check(increg->re, fname))
163 : return 1;
164 : return 0;
165 : }
166 : */
167 :
168 125 : static int in_exclude_regex(struct strlist *excreg, const char *fname)
169 : {
170 : // If not doing exclude_regex, let the file get backed up.
171 145 : for(; excreg; excreg=excreg->next)
172 23 : if(regex_check(excreg->re, fname))
173 : return 1;
174 : return 0;
175 : }
176 :
177 : // When recursing into directories, do not want to check the include_ext list.
178 : #ifndef UTEST
179 : static
180 : #endif
181 128 : int file_is_included_no_incext(struct conf **confs, const char *fname)
182 : {
183 128 : int ret=0;
184 128 : int longest=0;
185 128 : int matching=0;
186 128 : struct strlist *l=NULL;
187 128 : struct strlist *best=NULL;
188 :
189 128 : if(in_exclude_ext(get_strlist(confs[OPT_EXCEXT]), fname)
190 125 : || in_exclude_regex(get_strlist(confs[OPT_EXCREG]), fname))
191 : return 0;
192 :
193 : // Check include/exclude directories.
194 326 : for(l=get_strlist(confs[OPT_INCEXCDIR]); l; l=l->next)
195 : {
196 204 : matching=is_subdir(l->path, fname);
197 204 : if(matching>=longest)
198 : {
199 152 : longest=matching;
200 152 : best=l;
201 : }
202 : }
203 122 : if(!best) ret=0;
204 122 : else ret=best->flag;
205 :
206 122 : return ret;
207 : }
208 :
209 66 : static int file_is_included(struct conf **confs,
210 : const char *fname, bool top_level)
211 : {
212 : // Always save the top level directory.
213 : // This will help in the simulation of browsing backups because it
214 : // will mean that there is always a directory before any files:
215 : // d /home/graham
216 : // f /home/graham/somefile.txt
217 : // This means that we can use the stats of the directory (/home/graham
218 : // in this example) as the stats of the parent directories (/home,
219 : // for example). Trust me on this.
220 66 : if(!top_level
221 52 : && !in_include_ext(get_strlist(confs[OPT_INCEXT]), fname)) return 0;
222 :
223 63 : return file_is_included_no_incext(confs, fname);
224 : }
225 :
226 0 : static int fs_change_is_allowed(struct conf **confs, const char *fname)
227 : {
228 : struct strlist *l;
229 0 : if(get_int(confs[OPT_CROSS_ALL_FILESYSTEMS])) return 1;
230 0 : for(l=get_strlist(confs[OPT_FSCHGDIR]); l; l=l->next)
231 0 : if(!strcmp(l->path, fname)) return 1;
232 : return 0;
233 : }
234 :
235 6 : static int need_to_read_fifo(struct conf **confs, const char *fname)
236 : {
237 : struct strlist *l;
238 6 : if(get_int(confs[OPT_READ_ALL_FIFOS])) return 1;
239 7 : for(l=get_strlist(confs[OPT_FIFOS]); l; l=l->next)
240 5 : if(!strcmp(l->path, fname)) return 1;
241 : return 0;
242 : }
243 :
244 2 : static int need_to_read_blockdev(struct conf **confs, const char *fname)
245 : {
246 : struct strlist *l;
247 2 : if(get_int(confs[OPT_READ_ALL_BLOCKDEVS])) return 1;
248 3 : for(l=get_strlist(confs[OPT_BLOCKDEVS]); l; l=l->next)
249 3 : if(!strcmp(l->path, fname)) return 1;
250 : return 0;
251 : }
252 :
253 25 : static int nobackup_directory(struct strlist *nobackup, const char *path)
254 : {
255 : struct stat statp;
256 60 : for(; nobackup; nobackup=nobackup->next)
257 : {
258 7 : char *fullpath=NULL;
259 7 : if(!(fullpath=prepend_s(path, nobackup->path)))
260 2 : return -1;
261 14 : if(!lstat(fullpath, &statp))
262 : {
263 2 : free_w(&fullpath);
264 2 : return 1;
265 : }
266 5 : free_w(&fullpath);
267 : }
268 : return 0;
269 : }
270 :
271 29 : static int file_size_match(struct FF_PKT *ff_pkt, struct conf **confs)
272 : {
273 : uint64_t sizeleft;
274 29 : uint64_t min_file_size=get_uint64_t(confs[OPT_MIN_FILE_SIZE]);
275 29 : uint64_t max_file_size=get_uint64_t(confs[OPT_MAX_FILE_SIZE]);
276 29 : sizeleft=(uint64_t)ff_pkt->statp.st_size;
277 :
278 29 : if(min_file_size && sizeleft<min_file_size)
279 : return 0;
280 28 : if(max_file_size && sizeleft>max_file_size)
281 : return 0;
282 : return 1;
283 : }
284 :
285 : // Last checks before actually processing the file system entry.
286 66 : static int send_file_w(struct asfd *asfd, struct FF_PKT *ff, bool top_level, struct conf **confs)
287 : {
288 66 : if(!file_is_included(confs, ff->fname, top_level)) return 0;
289 :
290 : // Doing the file size match here also catches hard links.
291 63 : if(S_ISREG(ff->statp.st_mode)
292 29 : && !file_size_match(ff, confs))
293 : return 0;
294 :
295 : /*
296 : * Handle hard linked files
297 : * Maintain a list of hard linked files already backed up. This
298 : * allows us to ensure that the data of each file gets backed
299 : * up only once.
300 : */
301 61 : if(ff->statp.st_nlink > 1
302 56 : && (S_ISREG(ff->statp.st_mode)
303 28 : || S_ISCHR(ff->statp.st_mode)
304 24 : || S_ISBLK(ff->statp.st_mode)
305 24 : || S_ISFIFO(ff->statp.st_mode)
306 24 : || S_ISSOCK(ff->statp.st_mode)))
307 : {
308 : struct f_link *lp;
309 4 : struct f_link **bucket=NULL;
310 :
311 4 : if((lp=linkhash_search(&ff->statp, &bucket)))
312 : {
313 2 : if(!strcmp(lp->name, ff->fname)) return 0;
314 2 : ff->link=lp->name;
315 : /* Handle link, file already saved */
316 2 : ff->type=FT_LNK_H;
317 : }
318 : else
319 : {
320 2 : if(linkhash_add(ff->fname,
321 : &ff->statp, bucket)) return -1;
322 : }
323 : }
324 :
325 61 : return send_file(asfd, ff, confs);
326 : }
327 :
328 : static int found_regular_file(struct asfd *asfd,
329 : struct FF_PKT *ff_pkt, struct conf **confs,
330 : bool top_level)
331 : {
332 31 : ff_pkt->type=FT_REG;
333 31 : return send_file_w(asfd, ff_pkt, top_level, confs);
334 : }
335 :
336 1 : static int found_soft_link(struct asfd *asfd, struct FF_PKT *ff_pkt, struct conf **confs,
337 : char *fname, bool top_level)
338 : {
339 : ssize_t size;
340 1 : char *buffer=(char *)alloca(fs_full_path_max+102);
341 :
342 2 : if((size=readlink(fname, buffer, fs_full_path_max+101))<0)
343 : {
344 : /* Could not follow link */
345 0 : ff_pkt->type=FT_NOFOLLOW;
346 : }
347 : else
348 : {
349 1 : buffer[size]=0;
350 1 : ff_pkt->link=buffer; /* point to link */
351 1 : ff_pkt->type=FT_LNK_S; /* got a soft link */
352 : }
353 1 : return send_file_w(asfd, ff_pkt, top_level, confs);
354 : }
355 :
356 13 : static int fstype_excluded(struct asfd *asfd,
357 : struct conf **confs, const char *fname)
358 : {
359 : #if defined(HAVE_LINUX_OS)
360 : struct statfs buf;
361 : struct strlist *l;
362 13 : if(statfs(fname, &buf))
363 : {
364 0 : logw(asfd, get_cntr(confs), "Could not statfs %s: %s\n",
365 0 : fname, strerror(errno));
366 0 : return -1;
367 : }
368 13 : for(l=get_strlist(confs[OPT_EXCFS]); l; l=l->next)
369 0 : if(l->flag==buf.f_type)
370 : return -1;
371 : #endif
372 : return 0;
373 : }
374 :
375 : #if defined(HAVE_WIN32)
376 : static void windows_reparse_point_fiddling(struct FF_PKT *ff_pkt)
377 : {
378 : /*
379 : * We have set st_rdev to 1 if it is a reparse point, otherwise 0,
380 : * if st_rdev is 2, it is a mount point.
381 : */
382 : /*
383 : * A reparse point (WIN32_REPARSE_POINT)
384 : * is something special like one of the following:
385 : * IO_REPARSE_TAG_DFS 0x8000000A
386 : * IO_REPARSE_TAG_DFSR 0x80000012
387 : * IO_REPARSE_TAG_HSM 0xC0000004
388 : * IO_REPARSE_TAG_HSM2 0x80000006
389 : * IO_REPARSE_TAG_SIS 0x80000007
390 : * IO_REPARSE_TAG_SYMLINK 0xA000000C
391 : *
392 : * A junction point is a:
393 : * IO_REPARSE_TAG_MOUNT_POINT 0xA0000003
394 : * which can be either a link to a Volume (WIN32_MOUNT_POINT)
395 : * or a link to a directory (WIN32_JUNCTION_POINT)
396 : *
397 : * Ignore WIN32_REPARSE_POINT and WIN32_JUNCTION_POINT
398 : */
399 : if (ff_pkt->statp.st_rdev == WIN32_REPARSE_POINT) {
400 : ff_pkt->type = FT_REPARSE;
401 : } else if (ff_pkt->statp.st_rdev == WIN32_JUNCTION_POINT) {
402 : ff_pkt->type = FT_JUNCTION;
403 : }
404 : }
405 : #endif
406 :
407 : // Prototype because process_entries_in_directory() recurses using find_files().
408 : static int find_files(struct asfd *asfd,
409 : struct FF_PKT *ff_pkt, struct conf **confs,
410 : char *fname, dev_t parent_device, bool top_level);
411 :
412 17 : static int process_entries_in_directory(struct asfd *asfd, char **nl,
413 : int count, char **link, size_t len, size_t *link_len,
414 : struct conf **confs, struct FF_PKT *ff_pkt, dev_t our_device)
415 : {
416 17 : int m=0;
417 17 : int ret=0;
418 76 : for(m=0; m<count; m++)
419 : {
420 : size_t i;
421 59 : char *p=NULL;
422 59 : char *q=NULL;
423 : size_t plen;
424 :
425 59 : p=nl[m];
426 :
427 59 : if(strlen(p)+len>=*link_len)
428 : {
429 0 : *link_len=len+strlen(p)+1;
430 0 : if(!(*link=(char *)
431 0 : realloc_w(*link, (*link_len)+1, __func__)))
432 : return -1;
433 : }
434 59 : q=(*link)+len;
435 59 : plen=strlen(p);
436 159 : for(i=0; i<plen; i++)
437 100 : *q++=*p++;
438 59 : *q=0;
439 59 : ff_pkt->flen=i;
440 :
441 59 : if(file_is_included_no_incext(confs, *link))
442 : {
443 50 : ret=find_files(asfd, ff_pkt,
444 : confs, *link, our_device, false /*top_level*/);
445 : }
446 : else
447 : {
448 : struct strlist *x;
449 : // Excluded, but there might be a subdirectory that is
450 : // included.
451 26 : for(x=get_strlist(confs[OPT_INCEXCDIR]); x; x=x->next)
452 : {
453 17 : if(x->flag
454 14 : && is_subdir(*link, x->path))
455 : {
456 : struct strlist *y;
457 4 : if((ret=find_files(asfd, ff_pkt,
458 : confs, x->path,
459 : our_device, false)))
460 : break;
461 : // Now need to skip subdirectories of
462 : // the thing that we just stuck in
463 : // find_one_file(), or we might get
464 : // some things backed up twice.
465 6 : for(y=x->next; y; y=y->next)
466 2 : if(y->next
467 1 : && is_subdir(x->path, y->path))
468 1 : y=y->next;
469 : }
470 : }
471 : }
472 59 : free_w(&(nl[m]));
473 59 : if(ret) break;
474 : }
475 17 : return ret;
476 : }
477 :
478 25 : static int found_directory(struct asfd *asfd,
479 : struct FF_PKT *ff_pkt, struct conf **confs,
480 : char *fname, dev_t parent_device, bool top_level)
481 : {
482 25 : int ret=-1;
483 25 : char *link=NULL;
484 : size_t link_len;
485 : size_t len;
486 25 : int nbret=0;
487 25 : int count=0;
488 : dev_t our_device;
489 25 : char **nl=NULL;
490 :
491 25 : our_device=ff_pkt->statp.st_dev;
492 :
493 25 : if((nbret=nobackup_directory(get_strlist(confs[OPT_NOBACKUP]),
494 25 : ff_pkt->fname)))
495 : {
496 2 : if(nbret<0) goto end; // Error.
497 2 : ret=0; // Do not back it up.
498 2 : goto end;
499 : }
500 :
501 : /* Build a canonical directory name with a trailing slash in link var */
502 23 : len=strlen(fname);
503 23 : link_len=len+200;
504 23 : if(!(link=(char *)malloc_w(link_len+2, __func__)))
505 : goto end;
506 23 : snprintf(link, link_len, "%s", fname);
507 :
508 : /* Strip all trailing slashes */
509 23 : while(len >= 1 && IsPathSeparator(link[len - 1])) len--;
510 : /* add back one */
511 23 : link[len++]='/';
512 23 : link[len]=0;
513 :
514 23 : ff_pkt->link=link;
515 23 : ff_pkt->type=FT_DIR;
516 :
517 : #if defined(HAVE_WIN32)
518 : windows_reparse_point_fiddling(ff_pkt);
519 : #endif
520 :
521 23 : if(send_file_w(asfd, ff_pkt, top_level, confs))
522 : goto end;
523 23 : if(ff_pkt->type==FT_REPARSE || ff_pkt->type==FT_JUNCTION)
524 : {
525 : // Ignore.
526 : ret=0;
527 : goto end;
528 : }
529 :
530 23 : if(top_level
531 10 : || (parent_device!=ff_pkt->statp.st_dev
532 : #if defined(HAVE_WIN32)
533 : || ff_pkt->statp.st_rdev==WIN32_MOUNT_POINT
534 : #endif
535 : ))
536 : {
537 13 : if(fstype_excluded(asfd, confs, ff_pkt->fname))
538 : {
539 0 : ret=send_file_w(asfd, ff_pkt, top_level, confs);
540 0 : goto end;
541 : }
542 13 : if(!top_level && !fs_change_is_allowed(confs, ff_pkt->fname))
543 : {
544 0 : ff_pkt->type=FT_NOFSCHG;
545 : // Just backup the directory and return.
546 0 : ret=send_file_w(asfd, ff_pkt, top_level, confs);
547 0 : goto end;
548 : }
549 : }
550 :
551 23 : ff_pkt->link=ff_pkt->fname;
552 :
553 23 : errno=0;
554 23 : switch(entries_in_directory_alphasort(fname,
555 : &nl, &count, get_int(confs[OPT_ATIME])))
556 : {
557 : case 0: break;
558 : case 1:
559 0 : ff_pkt->type=FT_NOOPEN;
560 0 : ret=send_file_w(asfd, ff_pkt, top_level, confs);
561 : default:
562 : goto end;
563 : }
564 :
565 23 : if(nl)
566 : {
567 17 : if(process_entries_in_directory(asfd, nl, count,
568 : &link, len, &link_len, confs, ff_pkt, our_device))
569 : goto end;
570 : }
571 : ret=0;
572 : end:
573 25 : free_w(&link);
574 25 : free_v((void **)&nl);
575 25 : return ret;
576 : }
577 :
578 9 : static int found_other(struct asfd *asfd, struct FF_PKT *ff_pkt,
579 : struct conf **confs, bool top_level)
580 : {
581 : #ifdef HAVE_FREEBSD_OS
582 : /*
583 : * On FreeBSD, all block devices are character devices, so
584 : * to be able to read a raw disk, we need the check for
585 : * a character device.
586 : * crw-r----- 1 root operator - 116, 0x00040002 Jun 9 19:32 /dev/ad0s3
587 : * crw-r----- 1 root operator - 116, 0x00040002 Jun 9 19:32 /dev/rad0s3
588 : */
589 : if((S_ISBLK(ff_pkt->statp.st_mode) || S_ISCHR(ff_pkt->statp.st_mode))
590 : && need_to_read_blockdev(confs, ff_pkt->fname))
591 : {
592 : #else
593 9 : if(S_ISBLK(ff_pkt->statp.st_mode)
594 2 : && need_to_read_blockdev(confs, ff_pkt->fname))
595 : {
596 : #endif
597 : /* raw partition */
598 2 : ff_pkt->type=FT_RAW;
599 : }
600 7 : else if(S_ISFIFO(ff_pkt->statp.st_mode)
601 6 : && need_to_read_fifo(confs, ff_pkt->fname))
602 : {
603 4 : ff_pkt->type=FT_FIFO;
604 : }
605 : else
606 : {
607 : /* The only remaining are special (character, ...) files */
608 3 : ff_pkt->type=FT_SPEC;
609 : }
610 9 : return send_file_w(asfd, ff_pkt, top_level, confs);
611 : }
612 :
613 68 : static int find_files(struct asfd *asfd, struct FF_PKT *ff_pkt, struct conf **confs,
614 : char *fname, dev_t parent_device, bool top_level)
615 : {
616 68 : ff_pkt->fname=fname;
617 68 : ff_pkt->link=fname;
618 :
619 : #ifdef HAVE_WIN32
620 : if(win32_lstat(fname, &ff_pkt->statp, &ff_pkt->winattr))
621 : #else
622 136 : if(lstat(fname, &ff_pkt->statp))
623 : #endif
624 : {
625 2 : ff_pkt->type=FT_NOSTAT;
626 2 : return send_file_w(asfd, ff_pkt, top_level, confs);
627 : }
628 :
629 66 : if(S_ISREG(ff_pkt->statp.st_mode))
630 62 : return found_regular_file(asfd, ff_pkt, confs, top_level);
631 35 : else if(S_ISLNK(ff_pkt->statp.st_mode))
632 : {
633 : #ifdef S_IFLNK
634 : /* A symlink.
635 : If they have specified the symlink in a read_blockdev
636 : argument, treat it as a block device.
637 : */
638 : struct strlist *l;
639 4 : for(l=get_strlist(confs[OPT_BLOCKDEVS]); l; l=l->next)
640 : {
641 3 : if(!strcmp(l->path, fname))
642 : {
643 2 : ff_pkt->statp.st_mode ^= S_IFLNK;
644 2 : ff_pkt->statp.st_mode |= S_IFBLK;
645 2 : return found_other(asfd, ff_pkt, confs,
646 : top_level);
647 : }
648 : }
649 : #endif
650 1 : return found_soft_link(asfd, ff_pkt, confs, fname, top_level);
651 : }
652 32 : else if(S_ISDIR(ff_pkt->statp.st_mode))
653 25 : return found_directory(asfd, ff_pkt, confs, fname,
654 : parent_device, top_level);
655 : else
656 7 : return found_other(asfd, ff_pkt, confs, top_level);
657 : }
658 :
659 14 : int find_files_begin(struct asfd *asfd,
660 : struct FF_PKT *ff_pkt, struct conf **confs, char *fname)
661 : {
662 14 : return find_files(asfd, ff_pkt,
663 : confs, fname, (dev_t)-1, 1 /* top_level */);
664 : }
|