1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
diff -aur pine4.50.orig/pine/osdep/rename pine4.50/pine/osdep/rename
--- pine4.50.orig/pine/osdep/rename 1993-07-15 19:07:14.000000000 -0400
+++ pine4.50/pine/osdep/rename 2002-12-06 16:14:17.000000000 -0500
@@ -1,3 +1,6 @@
+#ifndef PATH_MAX
+#define PATH_MAX 2048
+#endif
/*----------------------------------------------------------------------
Rename a file
@@ -10,7 +13,18 @@
rename_file(tmpfname, fname)
char *tmpfname, *fname;
{
- return(rename(tmpfname, fname));
+ char *resolvedpath;
+ int rc = 0;
+ if( (resolvedpath = (char *) malloc(PATH_MAX*sizeof(char))) == NULL ) {
+ dprint(2,(debugfile,"---- rename_file(%s, %s) failed ------\n",
+ tmpfname, fname));
+ return(-1);
+ }
+ /* resolves symbolic links */
+ realpath(fname, resolvedpath);
+ rc = rename(tmpfname, resolvedpath);
+ free(resolvedpath);
+ return(rc);
}
|