Deleted Added
full compact
fts.c (231891) fts.c (235647)
1/*-
2 * Copyright (c) 1990, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 22 unchanged lines hidden (view full) ---

31
32#if 0
33#if defined(LIBC_SCCS) && !defined(lint)
34static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94";
35#endif /* LIBC_SCCS and not lint */
36#endif
37
38#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1990, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 22 unchanged lines hidden (view full) ---

31
32#if 0
33#if defined(LIBC_SCCS) && !defined(lint)
34static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94";
35#endif /* LIBC_SCCS and not lint */
36#endif
37
38#include <sys/cdefs.h>
39__FBSDID("$FreeBSD: head/lib/libc/gen/fts.c 231891 2012-02-18 00:55:54Z delphij $");
39__FBSDID("$FreeBSD: head/lib/libc/gen/fts.c 235647 2012-05-19 12:44:27Z gleb $");
40
41#include "namespace.h"
42#include <sys/param.h>
43#include <sys/mount.h>
44#include <sys/stat.h>
45
46#include <dirent.h>
47#include <errno.h>
48#include <fcntl.h>
49#include <fts.h>
50#include <stdlib.h>
51#include <string.h>
52#include <unistd.h>
53#include "un-namespace.h"
54
40
41#include "namespace.h"
42#include <sys/param.h>
43#include <sys/mount.h>
44#include <sys/stat.h>
45
46#include <dirent.h>
47#include <errno.h>
48#include <fcntl.h>
49#include <fts.h>
50#include <stdlib.h>
51#include <string.h>
52#include <unistd.h>
53#include "un-namespace.h"
54
55#include "gen-private.h"
56
55static FTSENT *fts_alloc(FTS *, char *, size_t);
56static FTSENT *fts_build(FTS *, int);
57static void fts_lfree(FTSENT *);
58static void fts_load(FTS *, FTSENT *);
59static size_t fts_maxarglen(char * const *);
60static void fts_padjust(FTS *, FTSENT *);
61static int fts_palloc(FTS *, size_t);
62static FTSENT *fts_sort(FTS *, FTSENT *, size_t);

--- 629 unchanged lines hidden (view full) ---

692 * post-order visit to return the error. There is a special case
693 * here, if there was nothing to stat then it's not an error to
694 * not be able to stat. This is all fairly nasty. If a program
695 * needed sorted entries or stat information, they had better be
696 * checking FTS_NS on the returned nodes.
697 */
698 cderrno = 0;
699 if (nlinks || type == BREAD) {
57static FTSENT *fts_alloc(FTS *, char *, size_t);
58static FTSENT *fts_build(FTS *, int);
59static void fts_lfree(FTSENT *);
60static void fts_load(FTS *, FTSENT *);
61static size_t fts_maxarglen(char * const *);
62static void fts_padjust(FTS *, FTSENT *);
63static int fts_palloc(FTS *, size_t);
64static FTSENT *fts_sort(FTS *, FTSENT *, size_t);

--- 629 unchanged lines hidden (view full) ---

694 * post-order visit to return the error. There is a special case
695 * here, if there was nothing to stat then it's not an error to
696 * not be able to stat. This is all fairly nasty. If a program
697 * needed sorted entries or stat information, they had better be
698 * checking FTS_NS on the returned nodes.
699 */
700 cderrno = 0;
701 if (nlinks || type == BREAD) {
700 if (fts_safe_changedir(sp, cur, dirfd(dirp), NULL)) {
702 if (fts_safe_changedir(sp, cur, _dirfd(dirp), NULL)) {
701 if (nlinks && type == BREAD)
702 cur->fts_errno = errno;
703 cur->fts_flags |= FTS_DONTCHDIR;
704 descend = 0;
705 cderrno = errno;
706 } else
707 descend = 1;
708 } else

--- 463 unchanged lines hidden ---
703 if (nlinks && type == BREAD)
704 cur->fts_errno = errno;
705 cur->fts_flags |= FTS_DONTCHDIR;
706 descend = 0;
707 cderrno = errno;
708 } else
709 descend = 1;
710 } else

--- 463 unchanged lines hidden ---