From 369aaf7e5dcabf995683eea9a3a1e497ade9cd12 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 16 Mar 2007 21:41:50 +0100 Subject: * src/copy.c: Include filemode.h. (overwrite_prompt): Say "try to overwrite", not "overwrite", to make it clearer that the attempt may fail. Problem reported by Dan Jacobson in: http://lists.gnu.org/archive/html/bug-coreutils/2007-03/msg00130.html Output symbolic mode as well as numeric. * tests/mv/i-2 (fail): Adjust to new prompt format. --- src/copy.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/copy.c b/src/copy.c index 49bbb8ce4..4bdb75cbb 100644 --- a/src/copy.c +++ b/src/copy.c @@ -38,6 +38,7 @@ #include "euidaccess.h" #include "error.h" #include "fcntl--.h" +#include "filemode.h" #include "filenamecat.h" #include "full-write.h" #include "getpagesize.h" @@ -797,10 +798,14 @@ overwrite_prompt (char const *dst_name, struct stat const *dst_sb) { if (euidaccess (dst_name, W_OK) != 0) { + char perms[12]; /* "-rwxrwxrwx " ls-style modes. */ + strmode (dst_sb->st_mode, perms); + perms[10] = '\0'; fprintf (stderr, - _("%s: overwrite %s, overriding mode %04lo? "), + _("%s: try to overwrite %s, overriding mode %04lo (%s)? "), program_name, quote (dst_name), - (unsigned long int) (dst_sb->st_mode & CHMOD_MODE_BITS)); + (unsigned long int) (dst_sb->st_mode & CHMOD_MODE_BITS), + &perms[1]); } else { -- cgit v1.2.3-70-g09d2