Deleted Added
full compact
function.c (192381) function.c (193087)
1/*-
2 * Copyright (c) 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Cimarron D. Taylor of the University of California, Berkeley.
7 *
8 * Redistribution and use in source and binary forms, with or without

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

36
37#ifndef lint
38#if 0
39static const char sccsid[] = "@(#)function.c 8.10 (Berkeley) 5/4/95";
40#endif
41#endif /* not lint */
42
43#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Cimarron D. Taylor of the University of California, Berkeley.
7 *
8 * Redistribution and use in source and binary forms, with or without

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

36
37#ifndef lint
38#if 0
39static const char sccsid[] = "@(#)function.c 8.10 (Berkeley) 5/4/95";
40#endif
41#endif /* not lint */
42
43#include <sys/cdefs.h>
44__FBSDID("$FreeBSD: head/usr.bin/find/function.c 192381 2009-05-19 14:23:54Z avg $");
44__FBSDID("$FreeBSD: head/usr.bin/find/function.c 193087 2009-05-30 10:42:19Z jilles $");
45
46#include <sys/param.h>
47#include <sys/ucred.h>
48#include <sys/stat.h>
49#include <sys/types.h>
50#include <sys/acl.h>
51#include <sys/wait.h>
52#include <sys/mount.h>

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

438 if (strchr(entry->fts_accpath, '/') != NULL)
439 errx(1, "-delete: %s: relative path potentially not safe",
440 entry->fts_accpath);
441
442 /* Turn off user immutable bits if running as root */
443 if ((entry->fts_statp->st_flags & (UF_APPEND|UF_IMMUTABLE)) &&
444 !(entry->fts_statp->st_flags & (SF_APPEND|SF_IMMUTABLE)) &&
445 geteuid() == 0)
45
46#include <sys/param.h>
47#include <sys/ucred.h>
48#include <sys/stat.h>
49#include <sys/types.h>
50#include <sys/acl.h>
51#include <sys/wait.h>
52#include <sys/mount.h>

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

438 if (strchr(entry->fts_accpath, '/') != NULL)
439 errx(1, "-delete: %s: relative path potentially not safe",
440 entry->fts_accpath);
441
442 /* Turn off user immutable bits if running as root */
443 if ((entry->fts_statp->st_flags & (UF_APPEND|UF_IMMUTABLE)) &&
444 !(entry->fts_statp->st_flags & (SF_APPEND|SF_IMMUTABLE)) &&
445 geteuid() == 0)
446 chflags(entry->fts_accpath,
446 lchflags(entry->fts_accpath,
447 entry->fts_statp->st_flags &= ~(UF_APPEND|UF_IMMUTABLE));
448
449 /* rmdir directories, unlink everything else */
450 if (S_ISDIR(entry->fts_statp->st_mode)) {
451 if (rmdir(entry->fts_accpath) < 0 && errno != ENOTEMPTY)
452 warn("-delete: rmdir(%s)", entry->fts_path);
453 } else {
454 if (unlink(entry->fts_accpath) < 0)

--- 1242 unchanged lines hidden ---
447 entry->fts_statp->st_flags &= ~(UF_APPEND|UF_IMMUTABLE));
448
449 /* rmdir directories, unlink everything else */
450 if (S_ISDIR(entry->fts_statp->st_mode)) {
451 if (rmdir(entry->fts_accpath) < 0 && errno != ENOTEMPTY)
452 warn("-delete: rmdir(%s)", entry->fts_path);
453 } else {
454 if (unlink(entry->fts_accpath) < 0)

--- 1242 unchanged lines hidden ---