bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug#10305: coreutils-8.14, "rm -r" fails with EBADF


From: Jim Meyering
Subject: Re: bug#10305: coreutils-8.14, "rm -r" fails with EBADF
Date: Fri, 20 Jul 2012 14:34:38 +0200

Joachim Schmitz wrote:
...
> I've disable a bit of apparently dead code in src/remove.c
...
> /usr/local/bin/diff -EBbu ./src/remove.c.orig ./src/remove.c
> --- ./src/remove.c.orig       2012-05-01 15:55:08 -0500
> +++ ./src/remove.c    2012-06-18 10:06:04 -0500
> @@ -88,6 +88,7 @@
>    return st;
>  }
>
> +#ifndef __TANDEM /* not used anywhere */
>  /* Return true if *ST has been statted.  */
>  static inline bool
>  cache_statted (struct stat *st)
> @@ -101,6 +102,7 @@
>  {
>    return (0 <= st->st_size);
>  }
> +#endif /* !__TANDEM */
>
>  /* Return 1 if FILE is an unwritable non-symlink,
>     0 if it is writable or some other type of file,
> @@ -311,6 +313,7 @@
>    return RM_OK;
>  }
>
> +#ifndef __TANDEM
>  /* Return true if FILENAME is a directory (and not a symlink to a directory).
>     Otherwise, including the case in which lstat fails, return false.
>     *ST is FILENAME's tstatus.
> @@ -340,6 +343,7 @@
>    errno = saved_errno;
>    return is_non_dir;
>  }
> +#endif /* !__TANDEM */
>
>  /* When a function like unlink, rmdir, or fstatat fails with an errno
>     value of ERRNUM, return true if the specified file system object

Thanks.  I've simply removed those unused functions
and wrote a commit log entry for you.

I'll wait for an ACK from you before pushing this,
since you're listed as the author:


>From 033b669f50e3ef4de7ba5598c0b036069bd56778 Mon Sep 17 00:00:00 2001
From: Joachim Schmitz <address@hidden>
Date: Fri, 20 Jul 2012 14:32:53 +0200
Subject: [PATCH] maint: rm: remove unused static-inlined functions

* src/remove.c (cache_statted, is_dir_lstat): Remove unused
static-inlined functions.
Copyright-paperwork-exempt: Yes
---
 src/remove.c | 22 ----------------------
 1 file changed, 22 deletions(-)

diff --git a/src/remove.c b/src/remove.c
index f44a982..42f2063 100644
--- a/src/remove.c
+++ b/src/remove.c
@@ -88,13 +88,6 @@ cache_stat_init (struct stat *st)
   return st;
 }

-/* Return true if *ST has been statted.  */
-static inline bool
-cache_statted (struct stat *st)
-{
-  return (st->st_size != -1);
-}
-
 /* Return true if *ST has been statted successfully.  */
 static inline bool
 cache_stat_ok (struct stat *st)
@@ -311,21 +304,6 @@ prompt (FTS const *fts, FTSENT const *ent, bool is_dir,
   return RM_OK;
 }

-/* Return true if FILENAME is a directory (and not a symlink to a directory).
-   Otherwise, including the case in which lstat fails, return false.
-   *ST is FILENAME's tstatus.
-   Do not modify errno.  */
-static inline bool
-is_dir_lstat (int fd_cwd, char const *filename, struct stat *st)
-{
-  int saved_errno = errno;
-  bool is_dir =
-    (cache_fstatat (fd_cwd, filename, st, AT_SYMLINK_NOFOLLOW) == 0
-     && S_ISDIR (st->st_mode));
-  errno = saved_errno;
-  return is_dir;
-}
-
 /* Return true if FILENAME is a non-directory.
    Otherwise, including the case in which lstat fails, return false.
    *ST is FILENAME's tstatus.
--
1.7.11.2.249.g31c7954



reply via email to

[Prev in Thread] Current Thread [Next in Thread]