summaryrefslogtreecommitdiff
path: root/jffsX-utils
AgeCommit message (Collapse)Author
2020-02-09mtd-utils: Add checks to code that copies strings into fixed sized buffersDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2020-02-09mtd-utils: Fix various TOCTOU issuesDavid Oberhollenzer
This patch restructures various code parts that follow the pattern of "stat(x, &sb) ... makes_sense(&sb) ... open(x)". Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-11-10mkfs.jffs2: don't leak temporary buffer if readlink failsDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2018-10-02mtd-utils: Instead of doing preprocessor magic, just output off_t as long longThorsten Glaser
Fix warnings abot PRIdoff_t in libmtd.c, in mtd_read (and mtd_write): In file included from ../git/lib/libmtd.c:40:0: ../git/lib/libmtd.c: In function 'mtd_read': ../git/include/common.h:110:18: warning: format '%ld' expects argument of type 'long int', but argument 5 has type 'off_t {aka long long int}' [-Wformat=] ../git/include/common.h:120:2: note: in expansion of macro 'errmsg' errmsg(fmt, ##__VA_ARGS__); \ ^~~~~~ ../git/lib/libmtd.c:1082:10: note: in expansion of macro 'sys_errmsg' return sys_errmsg("cannot seek mtd%d to offset %"PRIdoff_t, ^~~~~~~~~~ /usr/lib/klibc/include/inttypes.h:28:17: note: format string is defined here #define PRId32 "d" Signed-off-by: Thorsten Glaser <tg@mirbsd.org> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2017-06-28Eliminate warnings about missing prototypesDavid Oberhollenzer
This patch eliminates warnings generated by the -Wmissing-prototypes option. With this flag set, we are now forced to have prototypes for all global, exported functions, that have to be made visible to the definitions and we are forced to mark all local functions as static. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2017-06-14jffsX-utils: Return error code if command line option is unknownDaniel Wagner
The tools in question will quit with an exit code 0 if the command line option was not recognized. By returning an error code a calling script has the possibility to distinguish between a real success and an invalid invocation. Signed-off-by: Daniel Wagner <daniel.wagner@siemens.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2017-06-14Use defines for exit code valuesDaniel Wagner
Make the usage of exit consist. That is use the pre defined exit values. Signed-off-by: Daniel Wagner <daniel.wagner@siemens.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2017-05-31mkfs.ubifs: Add support for symlinks in device tableDavid Engraf
It is not possible to change ownership for symlinks in the device table file. This patch adds support for symlinks equal to mkfs.jffs2 and updates the sample device table file. The permission entry for symlinks in the device table must be set to 0777. Signed-off-by: David Engraf <david.engraf@sysgo.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2017-03-02Fix build with muslKhem Raj
Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2016-12-06common: Fix 'unchecked return code' warningsBoris Brezillon
Several tools are simply not checking return code of functions marked with 'warn_unused_result'. Provide wrappers for the read/write functions to avoid patching old code and providing proper error handling. Fix the remaining ones (calls to fgets() and system()). Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
2016-11-17Unify version string printingDavid Oberhollenzer
When a program does sophisticated enough command line processing (i.e. getopt), make sure it responds to -V and --version. When a program prints a version string, make sure it uses the common_print_version macro to print out its name, that it is part of mtd-utils and the mtd-utils version from the build system in a fashion similar to common program packages like the GNU coreutils. When a program responds to -V/--version or -h/--help, make sure it reports success exit status. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at> Signed-off-by: Richard Weinberger <richard@nod.at>
2016-11-17Change build system to autotoolsRichard Weinberger
This patch is largely based on Richards original RFC. The major differences to the RFC patch are: - Add missing sumtools & mtdpart targets - Fix name of mkfs.jffs2 target - Add missing subdir-objects option for non-recursive make - Move all automake options to configure.ac - Add manpages to install target - Make XATTR & LZO support configurable - Install binaries to sbin directory like in the old build system - Install flash_erase wrapper script - Add files missing from distribution target Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at> Signed-off-by: Richard Weinberger <richard@nod.at>
2016-11-17Remove jffs-dump.cDavid Oberhollenzer
This _entire_ file is dead code. The download packages on the FTP server contain it all the way back to mtd-utils 1.0, but it isn't built in any of them. The git history (which dates back to 2006) contains no instance where that file was ever used in a build process. A quick look at various distribution packages didn't reveal any that contained a jffs-dump utilty. There have been no major changes to this file since the initial commit. It won't even compile as it doesn't have a PROGRAM_NAME defined required by common.h at least since 2010. At this point, it can be safeley assumed that nobody will miss this. They had at least 10 years to do something about it. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at> Signed-off-by: Richard Weinberger <richard@nod.at>
2016-08-25mtd-utils: mkfs.jffs2: initialize lzo decompression buffer sizeDavid Oberhollenzer
This fix was initialially part of a patch submitted by Carsten Schlote in January 2009. It didn't get merged back then because of coding style issues and a proposed buffer size change guessed by shotgun debugging. I was unable to reproduce the claimed segfaults in the compression function that lead to the proposed buffer size change. Valgrind did not issue any errors or warnings about the code in question either, so I didn't include the proposed buffer size change. The original patch also added a call to lzo_init(), which (according to LZO documentation & source code) does not actually perform any initialization, but only checks at runtime that the data type sizes and endianness of the library code match those in the caller code and should be unnecessary. Other fixes from the original patch have already been added over the years. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at> Signed-off-by: Richard Weinberger <richard@nod.at>
2015-11-12Fix scanf() formatstring for modern C versionDaniel Walter
mkfs.jffs2 is using an old assignment-allocation modifier for scanf(). Add a check so this modifier does not get confused with a float formatstring on newer C standard (C99 onwards). Signed-off-by: Daniel Walter <dwalter@sigma-star.at> Signed-off-by: Richard Weinberger <richard@nod.at>
2015-11-11mtd-utils: Restructure the mtd-utils source.Dongsheng Yang
* There is no code modification in this commit, only moving * the files to proper place. The user tools looks a little messy as we place almost the all tools in the root directory of mtd-utils. To make it more clear, I propose to introduce the following structure for our source code. mtd-utils/ |-- lib |-- include |-- misc-utils |-- jffsX-utils |-- nand-utils |-- nor-utils |-- ubi-utils |-- ubifs-utils `-- tests Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>