summaryrefslogtreecommitdiff
path: root/misc/lsattr.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2001-06-08 02:53:20 +0000
committerTheodore Ts'o <tytso@mit.edu>2001-06-08 02:53:20 +0000
commitb705640ae162093d40fc9f77e716bec891561ffe (patch)
treeb70a83569825498bd435793fe93ebc38ca93777d /misc/lsattr.c
parentb7846402ca8f58dc6e7ed967ba8eba8fae26b8db (diff)
downloade2fsprogs-b705640ae162093d40fc9f77e716bec891561ffe.tar.gz
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.
Diffstat (limited to 'misc/lsattr.c')
-rw-r--r--misc/lsattr.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/misc/lsattr.c b/misc/lsattr.c
index 6b5a8eba..2d8de697 100644
--- a/misc/lsattr.c
+++ b/misc/lsattr.c
@@ -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) {