[MPlayer-dev-eng] Re: [PATCH] fix for unconditional use of PATH_MAX

Robert Millan zeratul2 at wanadoo.es
Wed May 7 17:49:33 CEST 2003


On Fri, May 02, 2003 at 11:12:24PM +0200, Alban Bedel wrote:
> 
> If you care to send a patch then use only dynamic alloc. As we said we
> think that in such case it's not worth the #ifdef stuff when there is
> a solution wich work everywhere.

ok, please could you commit this one?

--- mplayer.c.old	2003-05-07 17:45:51.000000000 +0200
+++ mplayer.c	2003-05-07 17:47:07.000000000 +0200
@@ -827,19 +827,22 @@
       use_gui=0;
     }
     if (use_gui && playtree_iter){
-      char cwd[PATH_MAX+2];
+      char *cwd;
       // Remove Playtree and Playtree-Iter from memory as its not used by gui
       play_tree_iter_free(playtree_iter);
       playtree_iter=NULL;
       
-      if (getcwd(cwd, PATH_MAX) != (char *)NULL)
+      cwd = getcwd (NULL, 0);
+      if (cwd != (char *)NULL)
       {
+          realloc (cwd, strlen (cwd) + 1);
 	  strcat(cwd, "/");
           // Prefix relative paths with current working directory
           play_tree_add_bpf(playtree, cwd);
       }      
       // Import initital playtree into gui
       import_initial_playtree_into_gui(playtree, mconfig, enqueue);
+      free (cwd);
     }
 #endif

-- 
Robert Millan

make: *** No rule to make target `war'.  Stop.

Another world is possible - Just say no to genocide



More information about the MPlayer-dev-eng mailing list