diff options
| author | Tomas Bzatek <tbzatek@tbzatek.englab.brq.redhat.com> | 2008-06-16 12:11:40 +0200 |
|---|---|---|
| committer | Tomas Bzatek <tbzatek@tbzatek.englab.brq.redhat.com> | 2008-06-16 12:11:40 +0200 |
| commit | 91d8a99387576216086c74b34b64efe468c2cd7b (patch) | |
| tree | 656e9ce4cafee38dc50a700aa337abec28cdc7ae /common | |
| parent | 892e407c5f5e06fa8c0ca9250b3bc99851c6a61d (diff) | |
| download | tuxcmd-modules-91d8a99387576216086c74b34b64efe468c2cd7b.tar.xz | |
Crash fix in symlink resolving code
Diffstat (limited to 'common')
| -rw-r--r-- | common/treepathutils.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/common/treepathutils.c b/common/treepathutils.c index 6215a14..f898fea 100644 --- a/common/treepathutils.c +++ b/common/treepathutils.c @@ -326,19 +326,21 @@ void filelist_tree_resolve_symlinks_recurr(struct PathTree *tree, struct PathTre log("filelist_tree_resolve_symlinks: found '%s/%s' --> '%s'\n", path, t->node, t->data->sLinkTo); gchar *rel = resolve_relative(path, t->data->sLinkTo); log(" filelist_tree_resolve_symlinks: relative = '%s'\n", rel); - struct PathTree* link_t = filelist_tree_find_node_by_path(root_tree, rel); - if ((link_t) && (link_t->data)) { - /* WARNING: this is dangerous since we're destroying the symlink type */ -// t->data->ItemType = link_t->data->ItemType; - t->data->a_time = link_t->data->a_time; - t->data->c_time = link_t->data->c_time; - t->data->m_time = link_t->data->m_time; - t->data->iGID = link_t->data->iGID; - t->data->iUID = link_t->data->iUID; - t->data->iMode = link_t->data->iMode; - t->data->iSize = link_t->data->iSize; + if (rel) { + struct PathTree* link_t = filelist_tree_find_node_by_path(root_tree, rel); + if ((link_t) && (link_t->data)) { + /* WARNING: this is dangerous since we're destroying the symlink type */ + // t->data->ItemType = link_t->data->ItemType; + t->data->a_time = link_t->data->a_time; + t->data->c_time = link_t->data->c_time; + t->data->m_time = link_t->data->m_time; + t->data->iGID = link_t->data->iGID; + t->data->iUID = link_t->data->iUID; + t->data->iMode = link_t->data->iMode; + t->data->iSize = link_t->data->iSize; + } + g_free(rel); } - g_free(rel); } if ((strlen(path) == 1) && (IS_DIR_SEP(*path))) new_path = g_strconcat("/", t->node, NULL); |
