Commit fd002754 authored by Mike Miller's avatar Mike Miller

debian/patches/10_no_path_max.patch: Fix FTBFS when PATH_MAX is not defined, e.g. on GNU Hurd.

parent 1adda3c7
......@@ -4,6 +4,8 @@ cdargs (1.35-10) UNRELEASED; urgency=low
Policy. (Closes: #713003)
* debian/patches/09_avoid_backupfile_warning.patch: Check for existence
of ~/.cdargs before making a backup copy. (Closes: #713007)
* debian/patches/10_no_path_max.patch: Fix FTBFS when PATH_MAX is not
defined, e.g. on GNU Hurd.
* Refresh all patches so they apply cleanly.
* Canonicalize Vcs-* control fields.
* Remove obsolete DM-Upload-Allowed control field.
......
Description: Fix FTBFS when PATH_MAX is not defined, e.g. on GNU Hurd
Forwarded: no
Author: Mike Miller <mtmiller@ieee.org>
Last-Update: 2013-10-30
--- a/src/cdargs.cc
+++ b/src/cdargs.cc
@@ -930,8 +930,12 @@ string get_resultfile(void) {
}
char* get_cwd_as_charp(void) {
- char buf[PATH_MAX];
- char* result = getcwd(buf, sizeof(buf));
+ char *buf;
+ char *result = NULL;
+
+ size_t size = (size_t)pathconf(".", _PC_PATH_MAX);
+ if ((buf = (char *)malloc(size)) != NULL)
+ result = getcwd(buf, size);
if(result == NULL) {
message("cannot determine current working directory.exit.");
@@ -940,7 +944,9 @@ char* get_cwd_as_charp(void) {
}
/* this can be a memleak if not freed again */
/* but then ... how long does cdargs usually run? */
- return strdup(buf);
+ result = strdup(buf);
+ free(buf);
+ return result;
}
string get_cwd_as_string(void) {
......@@ -7,3 +7,4 @@
07_manpage_fsf_address.patch
08_gcc_format_security.patch
09_avoid_backupfile_warning.patch
10_no_path_max.patch
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment