elf: Fix wrong fscanf usage on tst-pldd
The fix done b2cd93fce6
does not really
work since macro strification does not expand the sizeof nor the
arithmetic operation.
Checked on x86_64-linux-gnu.
This commit is contained in:
parent
d0fa09a770
commit
c353689e49
|
@ -108,15 +108,16 @@ do_test (void)
|
||||||
loader and libc. */
|
loader and libc. */
|
||||||
{
|
{
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
char buffer[512];
|
#define BUFFERLEN 511
|
||||||
#define STRINPUT(size) "%" # size "s"
|
char buffer[BUFFERLEN + 1];
|
||||||
|
#define STRINPUT(size) XSTRINPUT(size)
|
||||||
|
#define XSTRINPUT(size) "%" # size "s"
|
||||||
|
|
||||||
FILE *out = fmemopen (pldd.out.buffer, pldd.out.length, "r");
|
FILE *out = fmemopen (pldd.out.buffer, pldd.out.length, "r");
|
||||||
TEST_VERIFY (out != NULL);
|
TEST_VERIFY (out != NULL);
|
||||||
|
|
||||||
/* First line is in the form of <pid>: <full path of executable> */
|
/* First line is in the form of <pid>: <full path of executable> */
|
||||||
TEST_COMPARE (fscanf (out, "%u: " STRINPUT (sizeof (buffer) - 1), &pid,
|
TEST_COMPARE (fscanf (out, "%u: " STRINPUT (BUFFERLEN), &pid, buffer), 2);
|
||||||
buffer), 2);
|
|
||||||
|
|
||||||
TEST_COMPARE (pid, *target_pid_ptr);
|
TEST_COMPARE (pid, *target_pid_ptr);
|
||||||
TEST_COMPARE (strcmp (basename (buffer), "tst-pldd"), 0);
|
TEST_COMPARE (strcmp (basename (buffer), "tst-pldd"), 0);
|
||||||
|
|
Loading…
Reference in a new issue