corresponding argument in a `quote (...)' call.
Add more precise diagnostics.
#include "error.h"
#include "lchown.h"
#include "group-member.h"
+#include "quote.h"
#include "savedir.h"
#include "xstrtol.h"
if (changed == CH_NOT_APPLIED)
{
printf (_("neither symbolic link %s nor referent has been changed\n"),
- file);
+ quote (file));
return;
}
default:
abort ();
}
- printf (fmt, file, groupname);
+ printf (fmt, quote (file), groupname);
}
/* Set *G according to NAME. */
unsigned long int tmp_long;
if (!ISDIGIT (*name))
- error (1, 0, _("invalid group name `%s'"), name);
+ error (1, 0, _("invalid group name %s"), quote (name));
s_err = xstrtoul (name, NULL, 0, &tmp_long, NULL);
if (s_err != LONGINT_OK)
STRTOL_FATAL_ERROR (name, _("group number"), s_err);
if (tmp_long > MAXGID)
- error (1, 0, _("invalid group number `%s'"), name);
+ error (1, 0, _("invalid group number %s"), quote (name));
*g = tmp_long;
}
if ((*xstat) (file, &file_stats))
{
if (force_silent == 0)
- error (0, errno, "%s", file);
+ error (0, errno, _("getting attributes of %s"), quote (file));
return 1;
}
of the specified group' errors. */
if (saved_errno == EPERM && !group_member (group))
{
- error (0, saved_errno, _("you are not a member of group `%s'"),
- groupname);
+ error (0, saved_errno, _("you are not a member of group %s"),
+ quote (groupname));
}
else if (saved_errno == EINVAL && group > MAXUID)
{
- error (0, 0, _("%s: invalid group number"), groupname);
+ error (0, 0, _("%s: invalid group number"),
+ quote (groupname));
}
else
{
- error (0, saved_errno, "%s", file);
+ error (0, saved_errno, _("changing group of %s"),
+ quote (file));
}
}
}
if (name_space == NULL)
{
if (force_silent == 0)
- error (0, errno, "%s", dir);
+ error (0, errno, "%s", quote (dir));
return 1;
}
{
struct stat ref_stats;
if (stat (reference_file, &ref_stats))
- error (1, errno, "%s", reference_file);
+ error (1, errno, _("getting attributes of %s"), quote (reference_file));
group = ref_stats.st_gid;
}
#include "error.h"
#include "filemode.h"
#include "modechange.h"
+#include "quote.h"
#include "savedir.h"
/* The official name of this program (e.g., no `g' prefix). */
default:
abort ();
}
- printf (fmt, file, (unsigned long) (mode & CHMOD_MODE_BITS), &perms[1]);
+ printf (fmt, quote (file),
+ (unsigned long) (mode & CHMOD_MODE_BITS), &perms[1]);
}
/* Change the mode of FILE according to the list of operations CHANGES.
if (lstat (file, &file_stats))
{
if (force_silent == 0)
- error (0, errno, "%s", file);
+ error (0, errno, _("getting attributes of %s"), quote (file));
return 1;
}
#ifdef S_ISLNK
if (stat (file, &file_stats))
{
if (force_silent == 0)
- error (0, errno, "%s", file);
+ error (0, errno, _("getting attributes of %s"), quote (file));
return 1;
}
}
if (fail)
{
if (force_silent == 0)
- error (0, saved_errno, "%s", file);
+ error (0, saved_errno, _("changing permissions of %s"),
+ quote (file));
errors = 1;
}
}
if (name_space == NULL)
{
if (force_silent == 0)
- error (0, errno, "%s", dir);
+ error (0, errno, "%s", quote (dir));
return 1;
}
else if (changes == MODE_MEMORY_EXHAUSTED)
error (1, 0, _("virtual memory exhausted"));
else if (changes == MODE_BAD_REFERENCE)
- error (1, errno, "%s", reference_file);
+ error (1, errno, _("getting attributes of %s"), quote (reference_file));
for (; optind < argc; ++optind)
{
#include "system.h"
#include "error.h"
#include "lchown.h"
+#include "quote.h"
#include "savedir.h"
/* The official name of this program (e.g., no `g' prefix). */
if (changed == CH_NOT_APPLIED)
{
printf (_("neither symbolic link %s nor referent has been changed\n"),
- file);
+ quote (file));
return;
}
if (lstat (file, &file_stats))
{
if (force_silent == 0)
- error (0, errno, "%s", file);
+ error (0, errno, _("getting attributes of %s"), quote (file));
return 1;
}
if (fail)
{
if (force_silent == 0)
- error (0, saved_errno, "%s", file);
+ error (0, saved_errno, _("changing ownership of %s"),
+ quote (file));
errors = 1;
}
}
if (name_space == NULL)
{
if (force_silent == 0)
- error (0, errno, "%s", dir);
+ error (0, errno, "%s", quote (dir));
return 1;
}
case FROM_OPTION:
{
char *u_dummy, *g_dummy;
- const char *e = parse_user_spec (argv[optind], &old_user, &old_group,
+ const char *e = parse_user_spec (argv[optind],
+ &old_user, &old_group,
&u_dummy, &g_dummy);
if (e)
- error (1, 0, "%s: %s", argv[optind], e);
+ error (1, 0, "%s: %s", quote (argv[optind]), e);
break;
}
case 'R':
struct stat ref_stats;
if (stat (reference_file, &ref_stats))
- error (1, errno, "%s", reference_file);
+ error (1, errno, _("getting attributes of %s"), quote (reference_file));
user = ref_stats.st_uid;
group = ref_stats.st_gid;