diff options
author | Felix Fietkau <nbd@openwrt.org> | 2007-08-21 18:23:57 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2007-08-21 18:23:57 +0000 |
commit | fe9d7531d8885ffec2e53b6139a597fecec3a25e (patch) | |
tree | f22cbba5ec9be377be1109f82143b39ce1cf49a8 /package/mtd | |
parent | 41da7aa7d9d1418193def975fe069cd22faaca6e (diff) | |
download | upstream-fe9d7531d8885ffec2e53b6139a597fecec3a25e.tar.gz upstream-fe9d7531d8885ffec2e53b6139a597fecec3a25e.tar.bz2 upstream-fe9d7531d8885ffec2e53b6139a597fecec3a25e.zip |
add sysupgrade script for config preserving system upgrades. only implemented for x86-2.6 at the moment, but can be ported to other platforms easily
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@8456 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/mtd')
-rw-r--r-- | package/mtd/src/jffs2.c | 7 | ||||
-rw-r--r-- | package/mtd/src/mtd.c | 2 |
2 files changed, 6 insertions, 3 deletions
diff --git a/package/mtd/src/jffs2.c b/package/mtd/src/jffs2.c index 7b68ae575f..f614a336ea 100644 --- a/package/mtd/src/jffs2.c +++ b/package/mtd/src/jffs2.c @@ -147,7 +147,7 @@ static void add_file(char *name, int parent) else fname = name; - inode = add_dirent(name, IFTODT(S_IFREG), parent); + inode = add_dirent(fname, IFTODT(S_IFREG), parent); memset(&ri, 0, sizeof(ri)); ri.magic = JFFS2_MAGIC_BITMASK; ri.nodetype = JFFS2_NODETYPE_INODE; @@ -223,6 +223,9 @@ int mtd_write_jffs2(char *mtd, char *filename, char *dir) goto done; } + if (!*dir) + target_ino = 1; + /* parse the structure of the jffs2 first * locate the directory that the file is going to be placed in */ for(;;) { @@ -253,7 +256,7 @@ int mtd_write_jffs2(char *mtd, char *filename, char *dir) struct jffs2_raw_dirent *de = (struct jffs2_raw_dirent *) node; /* is this the right directory name and is it a subdirectory of / */ - if ((de->pino == 1) && !strncmp(de->name, dir, de->nsize)) + if (*dir && (de->pino == 1) && !strncmp(de->name, dir, de->nsize)) target_ino = de->ino; /* store the last inode and version numbers for adding extra files */ diff --git a/package/mtd/src/mtd.c b/package/mtd/src/mtd.c index 92018c23cf..f3a13efd24 100644 --- a/package/mtd/src/mtd.c +++ b/package/mtd/src/mtd.c @@ -52,7 +52,7 @@ #define DEBUG -#define JFFS2_DEFAULT_DIR "tmp" +#define JFFS2_DEFAULT_DIR "" /* directory name without /, empty means root dir */ #define SYSTYPE_UNKNOWN 0 #define SYSTYPE_BROADCOM 1 |