Discussion:
[PATCH] hurd: Fix linknamespace of spawni
(too old to reply)
Samuel Thibault
2018-12-05 22:25:28 UTC
Permalink
* include/unistd.h (__confstr): Add prototype and hidden prototype.
* posix/confstr.c (confstr): Rename to __confstr.
(__confstr): Add hidden def.
(confstr): Add weak alias for __confstr.
* sysdeps/mach/hurd/spawni.c (__spawni): Call __confstr instead of
confstr.
---
ChangeLog | 9 +++++++++
include/unistd.h | 2 ++
posix/confstr.c | 4 +++-
sysdeps/mach/hurd/spawni.c | 4 ++--
4 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/include/unistd.h b/include/unistd.h
index a171b00326..a043431ecf 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -6,6 +6,8 @@
libc_hidden_proto (_exit, __noreturn__)
rtld_hidden_proto (_exit, __noreturn__)
libc_hidden_proto (alarm)
+extern size_t __confstr (int name, char *buf, size_t len);
+libc_hidden_proto (__confstr)
libc_hidden_proto (confstr)
libc_hidden_proto (execl)
libc_hidden_proto (execle)
diff --git a/posix/confstr.c b/posix/confstr.c
index de4cff76cc..73ebb2e254 100644
--- a/posix/confstr.c
+++ b/posix/confstr.c
@@ -29,7 +29,7 @@
of BUF with the value corresponding to NAME and zero-terminate BUF.
Return the number of bytes required to hold NAME's entire value. */
size_t
-confstr (int name, char *buf, size_t len)
+__confstr (int name, char *buf, size_t len)
{
const char *string = "";
size_t string_len = 1;
@@ -289,4 +289,6 @@ confstr (int name, char *buf, size_t len)
}
return string_len;
}
+libc_hidden_def (__confstr)
libc_hidden_def (confstr)
+weak_alias (__confstr, confstr)
diff --git a/sysdeps/mach/hurd/spawni.c b/sysdeps/mach/hurd/spawni.c
index b98e991d3b..ecc21d2a57 100644
--- a/sysdeps/mach/hurd/spawni.c
+++ b/sysdeps/mach/hurd/spawni.c
@@ -629,10 +629,10 @@ __spawni (pid_t *pid, const char *file,
/* There is no `PATH' in the environment.
The default search path is the current directory
followed by the path `confstr' returns for `_CS_PATH'. */
- len = confstr (_CS_PATH, (char *) NULL, 0);
+ len = __confstr (_CS_PATH, (char *) NULL, 0);
path = (char *) __alloca (1 + len);
path[0] = ':';
- (void) confstr (_CS_PATH, path + 1, len);
+ (void) __confstr (_CS_PATH, path + 1, len);
}

len = strlen (file) + 1;
--
2.15.1
Samuel Thibault
2018-12-05 22:25:41 UTC
Permalink
* include/unistd.h (__confstr): Add prototype and hidden prototype.
* posix/confstr.c (confstr): Rename to __confstr.
(__confstr): Add hidden def.
(confstr): Add weak alias for __confstr.
* sysdeps/mach/hurd/spawni.c (__spawni): Call __confstr instead of
confstr.
---
ChangeLog | 9 +++++++++
include/unistd.h | 2 ++
posix/confstr.c | 4 +++-
sysdeps/mach/hurd/spawni.c | 4 ++--
4 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/include/unistd.h b/include/unistd.h
index a171b00326..a043431ecf 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -6,6 +6,8 @@
libc_hidden_proto (_exit, __noreturn__)
rtld_hidden_proto (_exit, __noreturn__)
libc_hidden_proto (alarm)
+extern size_t __confstr (int name, char *buf, size_t len);
+libc_hidden_proto (__confstr)
libc_hidden_proto (confstr)
libc_hidden_proto (execl)
libc_hidden_proto (execle)
diff --git a/posix/confstr.c b/posix/confstr.c
index de4cff76cc..73ebb2e254 100644
--- a/posix/confstr.c
+++ b/posix/confstr.c
@@ -29,7 +29,7 @@
of BUF with the value corresponding to NAME and zero-terminate BUF.
Return the number of bytes required to hold NAME's entire value. */
size_t
-confstr (int name, char *buf, size_t len)
+__confstr (int name, char *buf, size_t len)
{
const char *string = "";
size_t string_len = 1;
@@ -289,4 +289,6 @@ confstr (int name, char *buf, size_t len)
}
return string_len;
}
+libc_hidden_def (__confstr)
libc_hidden_def (confstr)
+weak_alias (__confstr, confstr)
diff --git a/sysdeps/mach/hurd/spawni.c b/sysdeps/mach/hurd/spawni.c
index b98e991d3b..ecc21d2a57 100644
--- a/sysdeps/mach/hurd/spawni.c
+++ b/sysdeps/mach/hurd/spawni.c
@@ -629,10 +629,10 @@ __spawni (pid_t *pid, const char *file,
/* There is no `PATH' in the environment.
The default search path is the current directory
followed by the path `confstr' returns for `_CS_PATH'. */
- len = confstr (_CS_PATH, (char *) NULL, 0);
+ len = __confstr (_CS_PATH, (char *) NULL, 0);
path = (char *) __alloca (1 + len);
path[0] = ':';
- (void) confstr (_CS_PATH, path + 1, len);
+ (void) __confstr (_CS_PATH, path + 1, len);
}

len = strlen (file) + 1;
--
2.15.1
Florian Weimer
2018-12-06 14:34:26 UTC
Permalink
Post by Samuel Thibault
* include/unistd.h (__confstr): Add prototype and hidden prototype.
* posix/confstr.c (confstr): Rename to __confstr.
(__confstr): Add hidden def.
(confstr): Add weak alias for __confstr.
* sysdeps/mach/hurd/spawni.c (__spawni): Call __confstr instead of
confstr.
Looks reasonable to me, and it should fix the linknamespace failure.

Thanks,
Florian
Samuel Thibault
2018-12-07 19:23:21 UTC
Permalink
Post by Florian Weimer
Post by Samuel Thibault
* include/unistd.h (__confstr): Add prototype and hidden prototype.
* posix/confstr.c (confstr): Rename to __confstr.
(__confstr): Add hidden def.
(confstr): Add weak alias for __confstr.
* sysdeps/mach/hurd/spawni.c (__spawni): Call __confstr instead of
confstr.
Looks reasonable to me, and it should fix the linknamespace failure.
Applied, thanks!

Samuel

Samuel Thibault
2018-12-05 22:26:04 UTC
Permalink
Oops, sorry, that was a remnant in the same directory.

Samuel
Loading...