[LTP] [PATCH] cleanup: Replace libc functions with safe_macros
zhaogongyi
zhaogongyi@huawei.com
Mon Mar 22 04:32:38 CET 2021
Hi Li,
I am sorry for the compile error, thanks for your review!
I have resubmit the patch according you review, and i will make sure compile PASS at least locally in the future.
Best Regards,
Gongyi
发件人: Li Wang [mailto:liwang@redhat.com]
发送时间: 2021年3月19日 13:41
收件人: zhaogongyi <zhaogongyi@huawei.com>
抄送: LTP List <ltp@lists.linux.it>
主题: Re: [LTP] [PATCH] cleanup: Replace libc functions with safe_macros
Hi Gongyi,
Zhao Gongyi <zhaogongyi@huawei.com<mailto:zhaogongyi@huawei.com>> wrote:
--- a/testcases/kernel/syscalls/fanotify/fanotify03.c
+++ b/testcases/kernel/syscalls/fanotify/fanotify03.c
@@ -128,17 +128,13 @@ static void generate_events(void)
/*
* Generate sequence of events
*/
- if ((fd = open(fname, O_RDWR | O_CREAT, 0700)) == -1)
- exit(1);
- if (write(fd, fname, 1) == -1)
- exit(2);
+ fd = SAFE_OPEN(fname, O_RDWR | O_CREAT, 0700);
- lseek(fd, 0, SEEK_SET);
- if (read(fd, buf, BUF_SIZE) != -1)
- exit(3);
+ SAFE_WRITE(fd, fname, 1);
SAFE_READ/SAFE_WRITE requires 4 arguments, but only 3 given,
it even builds fails after applying this patch. So it'd be better to compile
PASS at least locally before sending it to ML.
--- a/testcases/kernel/syscalls/fanotify/fanotify07.c
+++ b/testcases/kernel/syscalls/fanotify/fanotify07.c
@@ -53,14 +53,12 @@ static void generate_events(void)
/*
* generate sequence of events
*/
- if ((fd = open(fname, O_RDWR | O_CREAT, 0700)) == -1)
- exit(1);
+ fd = SAFE_OPEN(FNAME, O_RDWR | O_CREAT, 0700);
FNAME --> fname
--
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20210322/a552f75c/attachment.htm>
More information about the ltp
mailing list