projects
/
lede-git
/
.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fritz_tffs_read: get tffs size from input file
[lede-git/.git]
/
package
/
utils
/
fritz-tools
/
src
/
fritz_tffs_read.c
diff --git
a/package/utils/fritz-tools/src/fritz_tffs_read.c
b/package/utils/fritz-tools/src/fritz_tffs_read.c
index 7c311a90caa4a0246431e2afc773ab5d1661350c..d1b3038e63a9333c638d1acd6f7a988b20d39ce4 100644
(file)
--- a/
package/utils/fritz-tools/src/fritz_tffs_read.c
+++ b/
package/utils/fritz-tools/src/fritz_tffs_read.c
@@
-36,14
+36,12
@@
#include <sys/stat.h>
#include <arpa/inet.h>
#include <sys/stat.h>
#include <arpa/inet.h>
-#define DEFAULT_TFFS_SIZE (256 * 1024)
-
#define TFFS_ID_END 0xffff
#define TFFS_ID_TABLE_NAME 0x01ff
static char *progname;
static char *input_file;
#define TFFS_ID_END 0xffff
#define TFFS_ID_TABLE_NAME 0x01ff
static char *progname;
static char *input_file;
-static unsigned long tffs_size
= DEFAULT_TFFS_SIZE
;
+static unsigned long tffs_size;
static char *name_filter = NULL;
static bool show_all = false;
static bool print_all_key_names = false;
static char *name_filter = NULL;
static bool show_all = false;
static bool print_all_key_names = false;
@@
-334,6
+332,12
@@
int main(int argc, char *argv[])
goto out;
}
goto out;
}
+ if (tffs_size == 0) {
+ fseek(fp, 0L, SEEK_END);
+ tffs_size = ftell(fp);
+ fseek(fp, 0L, SEEK_SET);
+ }
+
buffer = malloc(tffs_size);
if (fread(buffer, 1, tffs_size, fp) != tffs_size) {
buffer = malloc(tffs_size);
if (fread(buffer, 1, tffs_size, fp) != tffs_size) {