summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberto Ruiz <alberto.ruiz@codethink.co.uk>2011-09-23 18:16:31 +0100
committerAlberto Ruiz <alberto.ruiz@codethink.co.uk>2011-09-23 18:16:31 +0100
commitef7f1ba55ac6ae41a1d376c70f3c3c51c24dbd39 (patch)
treee8a3254f96785a21a95d4d17b05932f816a90742
parent98103727622d603e69810eae8ae9ff0c6ebed941 (diff)
downloadtbdiff-ef7f1ba55ac6ae41a1d376c70f3c3c51c24dbd39.tar.gz
Implemented support for symlinks
-rw-r--r--otap_create.c9
-rw-r--r--stat.c5
2 files changed, 8 insertions, 6 deletions
diff --git a/otap_create.c b/otap_create.c
index 6386ddf..a17d812 100644
--- a/otap_create.c
+++ b/otap_create.c
@@ -293,12 +293,15 @@ _otap_create_dir(FILE* stream, otap_stat_t* d)
static int
_otap_create_cmd_symlink_create (FILE *stream,
- otap_stat_t *symlink)
+ otap_stat_t *symlink)
{
int err;
char path[2048];
-
- ssize_t len = readlink (symlink->name, path, sizeof(path)-1);
+ char *slpath = otap_stat_path (symlink);
+ ssize_t len = readlink (slpath, path, sizeof(path)-1);
+ free (slpath);
+
+
if (len < 0)
return otap_error_unable_to_read_symlink;
diff --git a/stat.c b/stat.c
index 99dd0b9..54751bc 100644
--- a/stat.c
+++ b/stat.c
@@ -39,6 +39,8 @@ __otap_stat_fd(const char *name,
}
else if(S_ISDIR(info.st_mode))
{
+ if (fd < 0)
+ return NULL;
ret->type = otap_stat_type_dir;
DIR* dp = fdopendir(fd);
@@ -152,9 +154,6 @@ otap_stat_entry(otap_stat_t* file, uint32_t entry)
return NULL;
fd = open(spath, O_RDONLY);
- if(fd < 0)
- return NULL;
-
otap_stat_t* ret = __otap_stat_fd(ds->d_name, (const char*)spath, fd);
free(spath);