/* modechange.c -- file mode manipulation
- Copyright (C) 1989, 1990, 1997, 1998, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1989, 1990, 1997-2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
{
struct mode_change *head; /* First element of the linked list. */
struct mode_change *tail; /* An element of the linked list. */
- unsigned long mode_value; /* The mode value, if octal. */
+ uintmax_t mode_value; /* The mode value, if octal. */
char *string_end; /* Pointer to end of parsed value. */
mode_t umask_value; /* The umask value (surprise). */
tail = NULL;
#endif
- if (xstrtoul (mode_string, &string_end, 8, &mode_value, "") == LONGINT_OK)
+ if (xstrtoumax (mode_string, &string_end, 8, &mode_value, "") == LONGINT_OK)
{
struct mode_change *p;
- if (mode_value > CHMOD_MODE_BITS)
+ if (mode_value != (mode_value & CHMOD_MODE_BITS))
return MODE_INVALID;
p = make_node_op_equals ((mode_t) mode_value);
if (p == NULL)