]> git.donarmstrong.com Git - lilypond.git/blob - debian/patches/hurd_file_name_support
1a8493486eb7e2858d2640dee588bdb9d7799b32
[lilypond.git] / debian / patches / hurd_file_name_support
1 Description: Hurd build without PATH_MAX; currently broken
2 Forwarded: not-needed
3 Origin: vendor
4 Author: Don Armstrong <don@debian.org>
5 --- a/flower/file-name.cc
6 +++ b/flower/file-name.cc
7 @@ -77,9 +77,16 @@
8  string
9  get_working_directory ()
10  {
11 +#ifdef _GNU_SOURCE
12 +  char *cwd = get_current_dir_name();
13 +  string scwd(cwd);
14 +  free(cwd);
15 +  return scwd;
16 +#else
17    char cwd[PATH_MAX];
18    // getcwd returns NULL upon a failure, contents of cwd would be undefined!
19    return string (getcwd (cwd, PATH_MAX));
20 +#endif
21  }
22  
23  /* Join components to full file_name. */
24 --- a/flower/test-file-path.cc
25 +++ b/flower/test-file-path.cc
26 @@ -6,12 +6,26 @@
27  #include "yaffut.hh"
28  #include "config.hh"
29  
30 +string
31 +get_working_directory ()
32 +{
33 +#ifdef _GNU_SOURCE
34 +  char *cwd = get_current_dir_name();
35 +  string scwd(cwd);
36 +  free(cwd);
37 +  return scwd;
38 +#else
39 +  char cwd[PATH_MAX];
40 +  // getcwd returns NULL upon a failure, contents of cwd would be undefined!
41 +  return string (getcwd (cwd, PATH_MAX));
42 +#endif
43 +}
44 +
45  TEST (File_path, Find)
46  {
47    char const *extensions[] = {"ly", "", 0};
48    string file = "init";
49 -  char cwd[PATH_MAX];
50 -  if (!getcwd (cwd, PATH_MAX))
51 +  if (get_working_directory().empty())
52      {
53        cerr << "Could not get current work directory\n";
54        exit (1);