diff options
author | 2016-10-10 18:07:03 +0000 | |
---|---|---|
committer | 2016-10-10 18:07:03 +0000 | |
commit | 8833f31ee5a8336291f47e8aa22ba0b70af79fc8 (patch) | |
tree | 1bb6e68f50f54cda5fd1c1981eff81842e2275d3 | |
parent | Remove infinite loop detection from the s-command. (diff) | |
download | wireguard-openbsd-8833f31ee5a8336291f47e8aa22ba0b70af79fc8.tar.xz wireguard-openbsd-8833f31ee5a8336291f47e8aa22ba0b70af79fc8.zip |
remove some dead code that's only used in rm
-rw-r--r-- | bin/mv/rm.c | 70 |
1 files changed, 1 insertions, 69 deletions
diff --git a/bin/mv/rm.c b/bin/mv/rm.c index afb60b8d72e..deeb69fb8f3 100644 --- a/bin/mv/rm.c +++ b/bin/mv/rm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rm.c,v 1.7 2015/11/27 17:32:16 tedu Exp $ */ +/* $OpenBSD: rm.c,v 1.8 2016/10/10 18:07:03 tedu Exp $ */ /* $NetBSD: rm.c,v 1.19 1995/09/07 06:48:50 jtc Exp $ */ /*- @@ -52,9 +52,7 @@ extern char *__progname; static int eval, stdin_ok; -static int check(char *, char *, struct stat *); static void checkdot(char **); -static void rm_file(char **); static void rm_tree(char **); static void __dead @@ -160,72 +158,6 @@ rm_tree(char **argv) fts_close(fts); } -static void -rm_file(char **argv) -{ - struct stat sb; - int rval; - char *f; - - /* - * Remove a file. POSIX 1003.2 states that, by default, attempting - * to remove a directory is an error, so must always stat the file. - */ - while ((f = *argv++) != NULL) { - /* Assume if can't stat the file, can't unlink it. */ - if (lstat(f, &sb)) { - if (errno != ENOENT) { - warn("%s", f); - eval = 1; - } - continue; - } - - if (S_ISDIR(sb.st_mode)) { - warnx("%s: is a directory", f); - eval = 1; - continue; - } - if (S_ISDIR(sb.st_mode)) - rval = rmdir(f); - else { - rval = unlink(f); - } - if (rval && (errno != ENOENT)) { - warn("%s", f); - eval = 1; - } - } -} - -static int -check(char *path, char *name, struct stat *sp) -{ - int ch, first; - char modep[15]; - - /* - * If it's not a symbolic link and it's unwritable and we're - * talking to a terminal, ask. Symbolic links are excluded - * because their permissions are meaningless. Check stdin_ok - * first because we may not have stat'ed the file. - */ - if (!stdin_ok || S_ISLNK(sp->st_mode) || !access(name, W_OK) || - errno != EACCES) - return (1); - strmode(sp->st_mode, modep); - (void)fprintf(stderr, "override %s%s%s/%s for %s? ", - modep + 1, modep[9] == ' ' ? "" : " ", - user_from_uid(sp->st_uid, 0), - group_from_gid(sp->st_gid, 0), path); - (void)fflush(stderr); - - first = ch = getchar(); - while (ch != '\n' && ch != EOF) - ch = getchar(); - return (first == 'y' || first == 'Y'); -} - /* * POSIX.2 requires that if "." or ".." are specified as the basename * portion of an operand, a diagnostic message be written to standard |