ChangeLog, chattr.c, lsattr.c:

chattr.c, lsattr.c: Don't use _FILE_BITS_OFFSET method of using the
  	64-bit function, since this changes the expected size of struct
  	dirent.  Instead use lseek64 explicitly.
bitmap-optimize
Theodore Ts'o 2001-06-08 02:53:20 +00:00
parent b7846402ca
commit b705640ae1
3 changed files with 28 additions and 8 deletions

View File

@ -1,3 +1,9 @@
2001-06-07 Theodore Tso <tytso@valinux.com>
* chattr.c, lsattr.c: Don't use _FILE_BITS_OFFSET method of using
the 64-bit function, since this changes the expected size
of struct dirent. Instead use lseek64 explicitly.
2001-06-01 Theodore Tso <tytso@valinux.com>
* Makefile.in: Move include/asm/types.h.in to

View File

@ -19,7 +19,6 @@
*/
#define _LARGEFILE64_SOURCE
#define _FILE_OFFSET_BITS 64
#include <sys/types.h>
#include <dirent.h>
@ -65,6 +64,14 @@ static unsigned long af;
static unsigned long rf;
static unsigned long sf;
#ifdef _LFS64_LARGEFILE
#define LSTAT lstat64
#define STRUCT_STAT struct stat64
#else
#define LSTAT lstat
#define STRUCT_STAT struct stat
#endif
static void fatal_error(const char * fmt_string, int errcode)
{
fprintf (stderr, fmt_string, program_name);
@ -170,9 +177,9 @@ static int chattr_dir_proc (const char *, struct dirent *, void *);
static void change_attributes (const char * name)
{
unsigned long flags;
struct stat st;
STRUCT_STAT st;
if (lstat (name, &st) == -1) {
if (LSTAT (name, &st) == -1) {
com_err (program_name, errno, _("while trying to stat %s"),
name);
return;

View File

@ -18,7 +18,6 @@
*/
#define _LARGEFILE64_SOURCE
#define _FILE_OFFSET_BITS 64
#include <sys/types.h>
#include <dirent.h>
@ -55,6 +54,14 @@ static int recursive;
static int verbose;
static int generation_opt;
#ifdef _LFS64_LARGEFILE
#define LSTAT lstat64
#define STRUCT_STAT struct stat64
#else
#define LSTAT lstat
#define STRUCT_STAT struct stat
#endif
static void usage(void)
{
fprintf(stderr, _("Usage: %s [-RVadlv] [files...]\n"), program_name);
@ -94,9 +101,9 @@ static int lsattr_dir_proc (const char *, struct dirent *, void *);
static void lsattr_args (const char * name)
{
struct stat st;
STRUCT_STAT st;
if (lstat (name, &st) == -1)
if (LSTAT (name, &st) == -1)
com_err (program_name, errno, _("while trying to stat %s"),
name);
else {
@ -109,13 +116,13 @@ static void lsattr_args (const char * name)
static int lsattr_dir_proc (const char * dir_name, struct dirent * de, void * private)
{
struct stat st;
STRUCT_STAT st;
char *path;
path = malloc(strlen (dir_name) + 1 + strlen (de->d_name) + 1);
sprintf (path, "%s/%s", dir_name, de->d_name);
if (lstat (path, &st) == -1)
if (LSTAT (path, &st) == -1)
perror (path);
else {
if (de->d_name[0] != '.' || all) {