cvs commit: ALFS/nALFS/src/lib get_url.c

kpfleming at linuxfromscratch.org kpfleming at linuxfromscratch.org
Tue Dec 30 07:43:29 PST 2003


kpfleming    03/12/30 08:43:29

  Modified:    nALFS/src/lib get_url.c
  Log:
  fix for bug 734, download temp files need to be created on the same filesystem as the final download location
  
  Revision  Changes    Path
  1.3       +10 -1     ALFS/nALFS/src/lib/get_url.c
  
  Index: get_url.c
  ===================================================================
  RCS file: /home/cvsroot/ALFS/nALFS/src/lib/get_url.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- get_url.c	24 Oct 2003 03:28:16 -0000	1.2
  +++ get_url.c	30 Dec 2003 15:43:29 -0000	1.3
  @@ -28,6 +28,7 @@
   #include <errno.h>
   #include <sys/types.h>
   #include <sys/stat.h>
  +#include <libgen.h>
   
   #ifdef HAVE_CONFIG_H
   #include <config.h>
  @@ -47,12 +48,20 @@
   	int status = -1;
   	int command_status;
   	struct stat stat_buf;
  +	char *dirname_buf;
   	char *temp_file_name;
   	    
   
   	/* Construct a temporary filename */
   
  -	temp_file_name = xstrdup(".nALFS.XXXXXX");
  +	/* have to make a writable copy of the destination path in case
  +	   the dirname() function wants to modify it
  +	*/
  +	dirname_buf = xstrdup(destination);
  +	temp_file_name = xstrdup(dirname(dirname_buf));
  +	xfree(dirname_buf);
  +	append_str(&temp_file_name, "/");
  +	append_str(&temp_file_name, ".nALFS.XXXXXX");
   	if (create_temp_file(temp_file_name))
   		goto free_all_and_return;
   	/* There is a small risk that another user could create a symlink
  
  
  



More information about the alfs-log mailing list