b8d3bb
library: replace all uses of symlink() with symlinkat().
@@ -4,6 +4,7 @@
|
|
4
4
|
/* Released under the Standard MIT License; see COPYING.SLIBTOOL. */
|
5
5
|
/*******************************************************************/
|
6
6
|
|
7
|
+
|
7
8
|
|
8
9
|
|
9
10
|
|
@@ -21,6 +22,7 @@
|
|
21
22
|
|
22
23
|
|
23
24
|
static char * slbt_mri_argument(
|
25
|
+
int fdat,
|
24
26
|
char * arg,
|
25
27
|
char * buf)
|
26
28
|
{
|
@@ -50,7 +52,7 @@ static char * slbt_mri_argument(
|
|
50
52
|
if (!(tmpnam(buf)))
|
51
53
|
return 0;
|
52
54
|
|
53
|
-
if (!(
|
55
|
+
if (!(symlinkat(target,fdat,buf)))
|
54
56
|
lnk = buf;
|
55
57
|
}
|
56
58
|
|
@@ -127,8 +129,8 @@ int slbt_archive_import(
|
|
127
129
|
|
128
130
|
ectx->pid = pid;
|
129
131
|
|
130
|
-
dst = slbt_mri_argument(dstarchive,mridst);
|
131
|
-
src = slbt_mri_argument(srcarchive,mrisrc);
|
132
|
+
dst = slbt_mri_argument(fdcwd,dstarchive,mridst);
|
133
|
+
src = slbt_mri_argument(fdcwd,srcarchive,mrisrc);
|
132
134
|
fmt = "OPEN %s\n"
|
133
135
|
"ADDLIB %s\n"
|
134
136
|
"SAVE\n"
|
@@ -9,6 +9,7 @@
|
|
9
9
|
|
10
10
|
|
11
11
|
|
12
|
+
|
12
13
|
|
13
14
|
|
14
15
|
|
@@ -24,6 +25,7 @@ int slbt_create_symlink(
|
|
24
25
|
const char * lnkname,
|
25
26
|
bool flawrapper)
|
26
27
|
{
|
28
|
+
int fdcwd;
|
27
29
|
char ** oargv;
|
28
30
|
const char * slash;
|
29
31
|
char * ln[5];
|
@@ -99,8 +101,11 @@ int slbt_create_symlink(
|
|
99
101
|
/* restore execution context */
|
100
102
|
ectx->argv = oargv;
|
101
103
|
|
104
|
+
/* fdcwd */
|
105
|
+
fdcwd = slbt_driver_fdcwd(dctx);
|
106
|
+
|
102
107
|
/* create symlink */
|
103
|
-
if (
|
108
|
+
if (symlinkat(atarget,fdcwd,tmplnk))
|
104
109
|
return SLBT_SYSTEM_ERROR(dctx,tmplnk);
|
105
110
|
|
106
111
|
return rename(tmplnk,lnkname)
|
@@ -1357,8 +1357,8 @@ static int slbt_exec_link_create_archive(
|
|
1357
1357
|
if (slbt_exec_link_remove_file(dctx,ectx,arlink))
|
1358
1358
|
return SLBT_NESTED_ERROR(dctx);
|
1359
1359
|
|
1360
|
-
if (
|
1361
|
-
return
|
1360
|
+
if (slbt_create_symlink(dctx,ectx,arfile,arlink,0))
|
1361
|
+
return SLBT_NESTED_ERROR(dctx);
|
1362
1362
|
}
|
1363
1363
|
|
1364
1364
|
return 0;
|
@@ -1535,8 +1535,12 @@ static int slbt_exec_link_create_library(
|
|
1535
1535
|
if (slbt_exec_link_remove_file(dctx,ectx,ectx->rpathfilename))
|
1536
1536
|
return SLBT_NESTED_ERROR(dctx);
|
1537
1537
|
|
1538
|
-
if (
|
1539
|
-
|
1538
|
+
if (slbt_create_symlink(
|
1539
|
+
dctx,ectx,
|
1540
|
+
dctx->cctx->host.ldrpath,
|
1541
|
+
ectx->rpathfilename,
|
1542
|
+
0))
|
1543
|
+
return SLBT_NESTED_ERROR(dctx);
|
1540
1544
|
}
|
1541
1545
|
|
1542
1546
|
/* cwd */
|