diff options
author | Theodore Ts'o <tytso@mit.edu> | 1997-04-26 14:00:26 +0000 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 1997-04-26 14:00:26 +0000 |
commit | a418d3ad819323f871005d253f7f9ac378e78ba5 (patch) | |
tree | bcc26141c6ec23de4bce9cd886a1d085c08a1b69 /misc/chattr.c | |
parent | 50e1e10fa0ac12a3e2a9d20a75ee9041873cda96 (diff) | |
download | android_external_e2fsprogs-a418d3ad819323f871005d253f7f9ac378e78ba5.tar.gz android_external_e2fsprogs-a418d3ad819323f871005d253f7f9ac378e78ba5.tar.bz2 android_external_e2fsprogs-a418d3ad819323f871005d253f7f9ac378e78ba5.zip |
Many files:
Checked in e2fsprogs 0.5c
Diffstat (limited to 'misc/chattr.c')
-rw-r--r-- | misc/chattr.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/misc/chattr.c b/misc/chattr.c index 8df57e9f..a90bdf4d 100644 --- a/misc/chattr.c +++ b/misc/chattr.c @@ -16,12 +16,18 @@ * 94/02/27 - Integrated in Ted's distribution */ +#include <sys/types.h> #include <dirent.h> #include <fcntl.h> +#ifdef HAVE_GETOPT_H #include <getopt.h> +#endif #include <stdio.h> #include <stdlib.h> #include <unistd.h> +#ifdef HAVE_ERRNO_H +#include <errno.h> +#endif #include <sys/param.h> #include <sys/stat.h> #include <linux/ext2_fs.h> @@ -264,12 +270,17 @@ static void change_attributes (const char * name) static int chattr_dir_proc (const char * dir_name, struct dirent * de, void * private) { - char path[MAXPATHLEN]; - if (strcmp (de->d_name, ".") && strcmp (de->d_name, "..")) { + char *path; + + path = malloc(strlen (dir_name) + 1 + strlen (de->d_name) + 1); + if (!path) + fatal_error("Couldn't allocate path variable " + "in chattr_dir_proc", 1); sprintf (path, "%s/%s", dir_name, de->d_name); change_attributes (path); + free(path); } return 0; } |