Patch for libpst (for review)
Hi Jordi,
Saw on IRC logs that you needed a patch for libpst. What about the
attached patch?
If there is a need to build pst2dii that .cpp-file has to be patched too
(not done yet). Looks like it will be enabled if the right version
of /usr/bin/convert is found (probably from imagemagick). Not in the
build depends though. The /usr/bin/convert program I had installed
graphicsmagick-imagemagick-compat from was not the right one.
--- a/configure.in 2012-06-20 17:53:17.000000000 +0200
+++ b/configure.in 2012-06-20 18:01:24.000000000 +0200
@@ -4,6 +4,7 @@
AC_CONFIG_HEADER([config.h])
AM_INIT_AUTOMAKE
AC_CANONICAL_HOST
+AC_USE_SYSTEM_EXTENSIONS
#
# 1. Remember that version-info is current:revision:age, and age <= current.
--- a/src/libpst.c 2011-12-25 00:19:11.000000000 +0100
+++ b/src/libpst.c 2012-06-20 19:03:57.000000000 +0200
@@ -361,19 +361,36 @@
DEBUG_RET();
+#ifdef _GNU_SOURCE
+ pf->cwd = get_current_dir_name();
+#else
pf->cwd = pst_malloc(PATH_MAX+1);
getcwd(pf->cwd, PATH_MAX+1);
+#endif
pf->fname = strdup(name);
return 0;
}
int pst_reopen(pst_file *pf) {
+#ifdef _GNU_SOURCE
+ char *cwd = NULL;
+ cwd = get_current_dir_name();
+ if (cwd == NULL) return -1;
+ if (chdir(pf->cwd)) return -1;
+ if (!freopen(pf->fname, "rb", pf->fp)) return -1;
+ if (chdir(cwd)) {
+ free(cwd);
+ return -1;
+ }
+ free(cwd);
+#else
char cwd[PATH_MAX];
if (!getcwd(cwd, PATH_MAX)) return -1;
if (chdir(pf->cwd)) return -1;
if (!freopen(pf->fname, "rb", pf->fp)) return -1;
if (chdir(cwd)) return -1;
+#endif
return 0;
}
Reply to: