Whamcloud - gitweb
ChangeLog, chattr.c, lsattr.c:
authorTheodore Ts'o <tytso@mit.edu>
Fri, 8 Jun 2001 02:53:20 +0000 (02:53 +0000)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 8 Jun 2001 02:53:20 +0000 (02:53 +0000)
  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.

misc/ChangeLog
misc/chattr.c
misc/lsattr.c

index 8be9a31..64814d1 100644 (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
index 794e680..56fef2f 100644 (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;
index 6b5a8eb..2d8de69 100644 (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) {