From: Adrian Hunter <ext-adrian.hunter@nokia.com>
To: "linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>
Subject: [PATCH 1/3] [MTD-UTILS] fs-tests: fix symlink bug in integrity test
Date: Tue, 12 Aug 2008 14:08:06 +0300 [thread overview]
Message-ID: <48A16F16.4080208@nokia.com> (raw)
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
---
tests/fs-tests/integrity/integck.c | 23 ++++++++++++++++-------
1 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/tests/fs-tests/integrity/integck.c b/tests/fs-tests/integrity/integck.c
index f1a544a..be93d3e 100644
--- a/tests/fs-tests/integrity/integck.c
+++ b/tests/fs-tests/integrity/integck.c
@@ -1655,22 +1655,31 @@ static char *pick_symlink_target(const char *symlink_path)
return rel_path;
}
-static void symlink_new(struct dir_info *dir, const char *name)
+static void symlink_new(struct dir_info *dir, const char *name_)
{
struct symlink_info *s;
- char *path;
+ char *path, *target, *name = copy_string(name_);
size_t sz;
+ path = dir_path(dir, name);
+ target = pick_symlink_target(path);
+ if (symlink(target, path) == -1) {
+ CHECK(errno == ENOSPC);
+ full = 1;
+ free(target);
+ free(path);
+ free(name);
+ return;
+ }
+ free(path);
+
sz = sizeof(struct symlink_info);
s = malloc(sz);
CHECK(s != NULL);
memset(s, 0, sz);
add_dir_entry(dir, 's', name, s);
-
- path = dir_path(dir, name);
- s->target_pathname = pick_symlink_target(path);
- CHECK(symlink(s->target_pathname, path) != -1);
- free(path);
+ s->target_pathname = target;
+ free(name);
}
static void symlink_remove(struct symlink_info *symlink)
--
1.5.2.5
reply other threads:[~2008-08-12 11:06 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48A16F16.4080208@nokia.com \
--to=ext-adrian.hunter@nokia.com \
--cc=linux-mtd@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.