]> git.pld-linux.org Git - packages/dos2unix.git/blob - dos2unix-workaround-rename-EXDEV.patch
- Up to 5.1.1
[packages/dos2unix.git] / dos2unix-workaround-rename-EXDEV.patch
1 --- ./dos2unix.c.orig   2007-04-17 11:16:32.000000000 +0400
2 +++ ./dos2unix.c        2007-04-17 12:41:01.000000000 +0400
3 @@ -279,7 +279,7 @@
4    int RetVal = 0;
5    FILE *InF = NULL;
6    FILE *TempF = NULL;
7 -  char TempPath[16];
8 +  char *TempPath = (char *) malloc(sizeof(char) * strlen(ipInFN)+14);
9    struct stat StatBuf;
10    struct utimbuf UTimeBuf;
11    int fd;
12 @@ -288,7 +288,8 @@
13    if ((ipFlag->KeepDate) && stat(ipInFN, &StatBuf))
14      RetVal = -1;
15  
16 -  strcpy (TempPath, "./d2utmpXXXXXX");
17 +  strcpy (TempPath, ipInFN);
18 +  strcat (TempPath, "_u2dtmpXXXXXX");
19    if((fd=mkstemp (TempPath))<0) {
20           perror("Failed to open output temp file");
21           RetVal = -1;
22 @@ -349,6 +350,7 @@
23        RetVal = -1;
24      }
25    }
26 +  free (TempPath);
27    return RetVal;
28  }
29  
30 @@ -364,7 +366,7 @@
31    int RetVal = 0;
32    FILE *InF = NULL;
33    FILE *TempF = NULL;
34 -  char TempPath[16];
35 +  char *TempPath = (char *) malloc(sizeof(char) * strlen(ipInFN)+14);
36    struct stat StatBuf;
37    struct utimbuf UTimeBuf;
38    mode_t mode = S_IRUSR | S_IWUSR;
39 @@ -376,7 +378,8 @@
40    else
41      mode = StatBuf.st_mode;
42  
43 -  strcpy (TempPath, "./u2dtmpXXXXXX");
44 +  strcpy (TempPath, ipInFN);
45 +  strcat (TempPath, "_u2dtmpXXXXXX");
46    if((fd=mkstemp (TempPath))<0) {
47           perror("Failed to open output temp file");
48           RetVal = -1;
49 @@ -442,6 +445,7 @@
50      }
51      RetVal = -1;
52    }
53 +  free (TempPath);
54    return RetVal;
55  }
56  
This page took 0.047732 seconds and 3 git commands to generate.