aboutsummaryrefslogtreecommitdiff
path: root/squashfs-tools/pseudo.c
diff options
context:
space:
mode:
authorPhillip Lougher <phillip@squashfs.org.uk>2012-12-23 06:40:06 +0000
committerPhillip Lougher <phillip@squashfs.org.uk>2012-12-23 06:50:17 +0000
commit1ce12e4d89ffc1e2174a1ce27c6b794ecc197c20 (patch)
tree405b96db313066b24c4fe45db0d12562bac84a29 /squashfs-tools/pseudo.c
parent461b581eb58b209cd92ff874239023a8e7bdd621 (diff)
downloadsquashfs-tools-1ce12e4d89ffc1e2174a1ce27c6b794ecc197c20.tar.gz
pseudo: Increase max line length to 16384
Increase max line length to bring it into line with exclude/extract and sort files. Obviously longer lines can be entered if split across multiple lines with "\". Also replace bare constants with the MAX_LINE definition. Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
Diffstat (limited to 'squashfs-tools/pseudo.c')
-rw-r--r--squashfs-tools/pseudo.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/squashfs-tools/pseudo.c b/squashfs-tools/pseudo.c
index 13505dd..ed654de 100644
--- a/squashfs-tools/pseudo.c
+++ b/squashfs-tools/pseudo.c
@@ -39,6 +39,7 @@
#define TRUE 1
#define FALSE 0
+#define MAX_LINE 16384
struct pseudo_dev **pseudo_file = NULL;
int pseudo_count = 0;
@@ -498,10 +499,7 @@ error:
free(filename);
return FALSE;
}
-
-
-#define MAX_LINE 2048
int read_pseudo_file(struct pseudo **pseudo, char *filename)
{
@@ -522,26 +520,26 @@ int read_pseudo_file(struct pseudo **pseudo, char *filename)
while(1) {
int len;
- if(total + MAX_LINE > size) {
- line = realloc(line, size += MAX_LINE);
+ if(total + (MAX_LINE + 1) > size) {
+ line = realloc(line, size += (MAX_LINE + 1));
if(line == NULL) {
ERROR("No space in read_pseudo_file\n");
return FALSE;
}
}
- err = fgets(line + total, 2048, fd);
+ err = fgets(line + total, MAX_LINE + 1, fd);
if(err == NULL)
break;
len = strlen(line + total);
total += len;
- if(len == 2047 && line[total - 1] != '\n') {
+ if(len == MAX_LINE && line[total - 1] != '\n') {
/* line too large */
ERROR("Line too long when reading "
"pseudo file \"%s\", larger than "
- "2048 bytes\n", filename);
+ "%d bytes\n", MAX_LINE, filename);
goto failed;
}