You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/app-text/unix2dos/files/unix2dos-2.2-workaround-ren...

58 lines
1.3 KiB

--- ./unix2dos.c.orig 2007-09-29 11:13:16.000000000 +0400
+++ ./unix2dos.c 2007-09-29 11:15:22.000000000 +0400
@@ -204,7 +204,7 @@
int RetVal = 0;
FILE *InF = NULL;
FILE *TempF = NULL;
- char TempPath[16];
+ char *TempPath = (char *) malloc(sizeof(char) * strlen(ipInFN)+14);
struct stat StatBuf;
struct utimbuf UTimeBuf;
int fd;
@@ -213,7 +213,8 @@
if ((ipFlag->KeepDate) && stat(ipInFN, &StatBuf))
RetVal = -1;
- strcpy (TempPath, "./u2dtmpXXXXXX");
+ strcpy (TempPath, ipInFN);
+ strcat (TempPath, "_u2dtmpXXXXXX");
if((fd=mkstemp (TempPath)) < 0) {
perror("Can't open output temp file");
RetVal = -1;
@@ -276,6 +277,7 @@
}
}
+ free (TempPath);
return RetVal;
}
@@ -289,7 +291,7 @@
int RetVal = 0;
FILE *InF = NULL;
FILE *TempF = NULL;
- char TempPath[16];
+ char *TempPath = (char *) malloc(sizeof(char) * strlen(ipInFN)+14);
struct stat StatBuf;
struct utimbuf UTimeBuf;
int fd;
@@ -298,7 +300,8 @@
if ((ipFlag->KeepDate) && stat(ipInFN, &StatBuf))
RetVal = -1;
- strcpy (TempPath, "./u2dtmpXXXXXX");
+ strcpy (TempPath, ipInFN);
+ strcat (TempPath, "_u2dtmpXXXXXX");
if((fd=mkstemp (TempPath)) < 0) {
perror("Can't open output temp file");
RetVal = -1;
@@ -361,6 +364,8 @@
}
RetVal = -1;
}
+
+ free (TempPath);
return RetVal;
}