This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/2] Use libsupport for tst-spawn.c

* Adhemerval Zanella:

> No worries, I need to catch up with recent libsupport functionalities.
> Below it is an updated patch, which I think it replaces with better
> libsupport interfaces:


> +  TEST_COMPARE (lseek (fd2, 0, SEEK_CUR), strlen (fd2string));

I assume you could use xlseek here (and in the following code).

> +  TEST_COMPARE_BLOB (fd2string, strlen (fd2string), buf, strlen (buf));

Warning: This should use strlen (fd2string), not strlen (buf).  As far
as I can tell, buf is not necessarily null-terminated.

> +  TEST_COMPARE_BLOB (fd3string, strlen (fd3string), buf, strlen (buf));

> +  TEST_COMPARE_BLOB (fd1string, strlen (fd1string), buf, strlen (buf));

Same warning applies.

> +  TEST_VERIFY_EXIT ((fd1 = open (name, O_RDONLY)) != -1);

This is likely a case for xopen.

> +  /* Write something in the files.  */
> +  TEST_COMPARE (write (temp_fd1, fd1string, strlen (fd1string)),
> +		strlen (fd1string));
> +  TEST_COMPARE (write (temp_fd2, fd2string, strlen (fd2string)),
> +		strlen (fd2string));
> +  TEST_COMPARE (write (temp_fd3, fd3string, strlen (fd3string)),
> +		strlen (fd3string));

You can replace that with xwrite.

> +  /* We want to open the third file.  */
> +  TEST_VERIFY_EXIT ((name3_copy = strdup (name3)) != NULL);


We are getting close!


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]