* [LTP] [PATCH] openposix/fork/11-1.c: Clean up temporary file
@ 2021-02-19 5:04 zhao gongyi
2021-02-19 7:45 ` Li Wang
0 siblings, 1 reply; 4+ messages in thread
From: zhao gongyi @ 2021-02-19 5:04 UTC (permalink / raw)
To: ltp
We need to clean up temporary file /tmp/fork-11-1-XXXXXX which created by mkstemp.
Signed-off-by: zhao gongyi <zhaogongyi@huawei.com>
---
.../open_posix_testsuite/conformance/interfaces/fork/11-1.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/fork/11-1.c b/testcases/open_posix_testsuite/conformance/interfaces/fork/11-1.c
index a43bc274c..e9b18958c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/fork/11-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/fork/11-1.c
@@ -79,6 +79,8 @@ int main(void)
return result;
}
+ unlink(path_template);
+
if (fcntl(fd, F_SETLK, &fl) == -1) {
printf("Could not set initial lock: %s (%d)\n",
strerror(errno), errno);
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [LTP] [PATCH] openposix/fork/11-1.c: Clean up temporary file
2021-02-19 5:04 [LTP] [PATCH] openposix/fork/11-1.c: Clean up temporary file zhao gongyi
@ 2021-02-19 7:45 ` Li Wang
2021-02-19 9:34 ` [LTP] 答复: " zhaogongyi
0 siblings, 1 reply; 4+ messages in thread
From: Li Wang @ 2021-02-19 7:45 UTC (permalink / raw)
To: ltp
Hi Gongyi,
On Fri, Feb 19, 2021 at 1:05 PM zhao gongyi <zhaogongyi@huawei.com> wrote:
> We need to clean up temporary file /tmp/fork-11-1-XXXXXX which created by
> mkstemp.
>
> Signed-off-by: zhao gongyi <zhaogongyi@huawei.com>
> ---
> .../open_posix_testsuite/conformance/interfaces/fork/11-1.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git
> a/testcases/open_posix_testsuite/conformance/interfaces/fork/11-1.c
> b/testcases/open_posix_testsuite/conformance/interfaces/fork/11-1.c
> index a43bc274c..e9b18958c 100644
> --- a/testcases/open_posix_testsuite/conformance/interfaces/fork/11-1.c
> +++ b/testcases/open_posix_testsuite/conformance/interfaces/fork/11-1.c
> @@ -79,6 +79,8 @@ int main(void)
> return result;
> }
>
> + unlink(path_template);
>
Why do we need to delete the tempfile before acquiring a lock?
Or did you mean doing this after the testing(in the cleanup phase).
BTW, seems the child report a wrong status of the locked file, while
fcntl(fd, F_SETLK, &fl) return -1 and sets errno to EACCES or EAGAIN,
shouldn't that mean the file already been locked by the parent?
> +
> if (fcntl(fd, F_SETLK, &fl) == -1) {
> printf("Could not set initial lock: %s (%d)\n",
> strerror(errno), errno);
> --
> 2.17.1
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
>
>
--
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20210219/67f68260/attachment-0001.htm>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [LTP] 答复: [PATCH] openposix/fork/11-1.c: Clean up temporary file
2021-02-19 7:45 ` Li Wang
@ 2021-02-19 9:34 ` zhaogongyi
2021-02-19 13:38 ` [LTP] " Li Wang
0 siblings, 1 reply; 4+ messages in thread
From: zhaogongyi @ 2021-02-19 9:34 UTC (permalink / raw)
To: ltp
Hi Li,
I think we need to delete the tempfile after the testing(in the cleanup phase).
In this case, we just hope that call unlink after open/mkstemp since unlink would not destroy the inode,
so call unlink before fork would not affect the test?
???: Li Wang [mailto:liwang@redhat.com]
????: 2021?2?19? 15:45
???: zhaogongyi <zhaogongyi@huawei.com>
??: LTP List <ltp@lists.linux.it>
??: Re: [LTP] [PATCH] openposix/fork/11-1.c: Clean up temporary file
Hi Gongyi,
On Fri, Feb 19, 2021 at 1:05 PM zhao gongyi <zhaogongyi@huawei.com<mailto:zhaogongyi@huawei.com>> wrote:
We need to clean up temporary file /tmp/fork-11-1-XXXXXX which created by mkstemp.
Signed-off-by: zhao gongyi <zhaogongyi@huawei.com<mailto:zhaogongyi@huawei.com>>
---
.../open_posix_testsuite/conformance/interfaces/fork/11-1.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/fork/11-1.c b/testcases/open_posix_testsuite/conformance/interfaces/fork/11-1.c
index a43bc274c..e9b18958c 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/fork/11-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/fork/11-1.c
@@ -79,6 +79,8 @@ int main(void)
return result;
}
+ unlink(path_template);
Why do we need to delete the tempfile before acquiring a lock?
Or did you mean doing this after the testing(in the cleanup phase).
BTW, seems the child report a wrong status of the locked file, while
fcntl(fd, F_SETLK, &fl) return -1 and sets errno to EACCES or EAGAIN,
shouldn't that mean the file already been locked by the parent?
+
if (fcntl(fd, F_SETLK, &fl) == -1) {
printf("Could not set initial lock: %s (%d)\n",
strerror(errno), errno);
--
2.17.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
--
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20210219/d1be1a68/attachment.htm>
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [LTP] [PATCH] openposix/fork/11-1.c: Clean up temporary file
2021-02-19 9:34 ` [LTP] 答复: " zhaogongyi
@ 2021-02-19 13:38 ` Li Wang
0 siblings, 0 replies; 4+ messages in thread
From: Li Wang @ 2021-02-19 13:38 UTC (permalink / raw)
To: ltp
On Fri, Feb 19, 2021 at 5:34 PM zhaogongyi <zhaogongyi@huawei.com> wrote:
> Hi Li,
>
>
>
> I think we need to delete the tempfile after the testing(in the cleanup
> phase).
>
>
>
> In this case, we just hope that call unlink after open/mkstemp since
> unlink would not destroy the inode,
>
>
>
> so call unlink before fork would not affect the test?
>
Right, but better to put behind of close(fd) that makes logic more clear.
>
> BTW, seems the child report a wrong status of the locked file, while
>
> fcntl(fd, F_SETLK, &fl) return -1 and sets errno to EACCES or EAGAIN,
>
> shouldn't that mean the file already been locked by the parent?
>
And what do u think about this?
--
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20210219/044cfd15/attachment.htm>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-02-19 13:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-19 5:04 [LTP] [PATCH] openposix/fork/11-1.c: Clean up temporary file zhao gongyi
2021-02-19 7:45 ` Li Wang
2021-02-19 9:34 ` [LTP] 答复: " zhaogongyi
2021-02-19 13:38 ` [LTP] " Li Wang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.