summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--VERSION2
-rw-r--r--debian/changelog6
-rw-r--r--doc/CHANGES4
-rw-r--r--setfattr/setfattr.c46
4 files changed, 46 insertions, 12 deletions
diff --git a/VERSION b/VERSION
index 9ae3797..bf0975a 100644
--- a/VERSION
+++ b/VERSION
@@ -3,5 +3,5 @@
#
PKG_MAJOR=2
PKG_MINOR=4
-PKG_REVISION=21
+PKG_REVISION=22
PKG_BUILD=1
diff --git a/debian/changelog b/debian/changelog
index 62d3b9d..38bd62f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+attr (2.4.22-1) unstable; urgency=low
+
+ * New upstream release
+
+ -- Nathan Scott <nathans@debian.org> Mon, 21 Feb 2005 08:13:36 +1100
+
attr (2.4.21-1) unstable; urgency=low
* New upstream release
diff --git a/doc/CHANGES b/doc/CHANGES
index d8fd08d..fce03ed 100644
--- a/doc/CHANGES
+++ b/doc/CHANGES
@@ -1,3 +1,7 @@
+attr-2.4.22 (21 February 2005)
+ - Allocate the line buffer dynamically when reading from a file.
+ This mainly fixes restoring of large attributes.
+
attr-2.4.21 (31 January 2005)
- Replace use of _POSIX_PATH_MAX with the larger PATH_MAX
(thanks to Andree Leidenfrost).
diff --git a/setfattr/setfattr.c b/setfattr/setfattr.c
index 6cf8700..6f5deaa 100644
--- a/setfattr/setfattr.c
+++ b/setfattr/setfattr.c
@@ -180,17 +180,41 @@ void help(void)
char *next_line(FILE *file)
{
- static char line[PATH_MAX+32], *c;
- if (!fgets(line, sizeof(line), file))
- return NULL;
-
- c = strrchr(line, '\0');
- while (c > line && (*(c-1) == '\n' ||
- *(c-1) == '\r')) {
- c--;
- *c = '\0';
- }
- return line;
+ static char *line;
+ static size_t line_size;
+ char *c;
+ int eol = 0;
+
+ if (!line) {
+ if (high_water_alloc((void **)&line, &line_size, PATH_MAX)) {
+ perror(progname);
+ had_errors++;
+ return NULL;
+ }
+ }
+ c = line;
+ do {
+ if (!fgets(c, line_size - (c - line), file))
+ return NULL;
+ c = strrchr(c, '\0');
+ while (c > line && (*(c-1) == '\n' || *(c-1) == '\r')) {
+ c--;
+ *c = '\0';
+ eol = 1;
+ }
+ if (feof(file))
+ break;
+ if (!eol) {
+ if (high_water_alloc((void **)&line, &line_size,
+ 2 * line_size)) {
+ perror(progname);
+ had_errors++;
+ return NULL;
+ }
+ c = strrchr(line, '\0');
+ }
+ } while (!eol);
+ return line;
}
int main(int argc, char *argv[])