* [LTP] [PATCH 2/3] syscalls/pipe*: Fix compiler warnings
2018-03-02 8:02 [LTP] [PATCH 1/3] syscalls/fchmod*: Fix compiler warnings Jinhui Huang
@ 2018-03-02 8:02 ` Jinhui Huang
2018-03-05 8:03 ` Petr Vorel
2018-03-02 8:02 ` [LTP] [PATCH 3/3] syscalls/mknod*: " Jinhui Huang
2018-03-05 7:48 ` [LTP] [PATCH 1/3] syscalls/fchmod*: " Petr Vorel
2 siblings, 1 reply; 8+ messages in thread
From: Jinhui Huang @ 2018-03-02 8:02 UTC (permalink / raw)
To: ltp
Signed-off-by: Jinhui Huang <huangjh.jy@cn.fujitsu.com>
---
testcases/kernel/syscalls/pipe/pipe04.c | 2 +-
testcases/kernel/syscalls/pipe/pipe05.c | 4 ++--
testcases/kernel/syscalls/pipe/pipe07.c | 2 +-
testcases/kernel/syscalls/pipe/pipe08.c | 2 ++
testcases/kernel/syscalls/pipe/pipe11.c | 6 +++---
5 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/testcases/kernel/syscalls/pipe/pipe04.c b/testcases/kernel/syscalls/pipe/pipe04.c
index b3d255b..a3c56e3 100644
--- a/testcases/kernel/syscalls/pipe/pipe04.c
+++ b/testcases/kernel/syscalls/pipe/pipe04.c
@@ -235,7 +235,7 @@ void c2func(void)
tst_resm(TBROK | TERRNO, "[child 2] pipe write failed");
}
-void alarmfunc(int sig)
+void alarmfunc(int sig LTP_ATTRIBUTE_UNUSED)
{
/* for some reason tst_brkm doesn't seem to work in a signal handler */
tst_brkm(TFAIL, cleanup, "one or more children did't die in 60 second "
diff --git a/testcases/kernel/syscalls/pipe/pipe05.c b/testcases/kernel/syscalls/pipe/pipe05.c
index fe5ec37..4105988 100644
--- a/testcases/kernel/syscalls/pipe/pipe05.c
+++ b/testcases/kernel/syscalls/pipe/pipe05.c
@@ -59,7 +59,7 @@ void sig11_handler(int sig);
int main(int ac, char **av)
{
- int lc;
+ volatile int lc;
struct sigaction sa, osa;
tst_parse_opts(ac, av, NULL, NULL);
@@ -120,7 +120,7 @@ void setup(void)
/******************************************************************
* sig11_handler() - our segfault recover hack
******************************************************************/
-void sig11_handler(int sig)
+void sig11_handler(int sig LTP_ATTRIBUTE_UNUSED)
{
longjmp(sig11_recover, 1);
}
diff --git a/testcases/kernel/syscalls/pipe/pipe07.c b/testcases/kernel/syscalls/pipe/pipe07.c
index b09df71..55bb9f4 100644
--- a/testcases/kernel/syscalls/pipe/pipe07.c
+++ b/testcases/kernel/syscalls/pipe/pipe07.c
@@ -129,7 +129,7 @@ static void record_open_fds(void)
if (fd == dir_fd)
continue;
- if (rec_fds_max >= ARRAY_SIZE(rec_fds)) {
+ if (rec_fds_max >= (int)ARRAY_SIZE(rec_fds)) {
tst_brkm(TBROK, cleanup,
"Too much file descriptors open");
}
diff --git a/testcases/kernel/syscalls/pipe/pipe08.c b/testcases/kernel/syscalls/pipe/pipe08.c
index cdb2a4d..9f8d9cc 100644
--- a/testcases/kernel/syscalls/pipe/pipe08.c
+++ b/testcases/kernel/syscalls/pipe/pipe08.c
@@ -98,6 +98,8 @@ int main(int ac, char **av)
* sent
*/
written = write(pipefd[1], wrbuf, length);
+ if (written > 0)
+ tst_brkm(TBROK, cleanup, "write succeeded expectedly");
}
cleanup();
tst_exit();
diff --git a/testcases/kernel/syscalls/pipe/pipe11.c b/testcases/kernel/syscalls/pipe/pipe11.c
index e11c556..e3b2741 100644
--- a/testcases/kernel/syscalls/pipe/pipe11.c
+++ b/testcases/kernel/syscalls/pipe/pipe11.c
@@ -198,7 +198,8 @@ void do_child_uclinux(void)
*/
void setup(void)
{
- int i, j;
+ int i;
+ unsigned int j;
tst_sig(FORK, DEF_HANDLER, cleanup);
@@ -230,9 +231,8 @@ void setup(void)
j = 0;
for (i = 0; i < szcharbuf;) {
wrbuf[i++] = rawchars[j++];
- if (j >= sizeof(rawchars)) {
+ if (j >= sizeof(rawchars))
j = 0;
- }
}
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [LTP] [PATCH 2/3] syscalls/pipe*: Fix compiler warnings
2018-03-02 8:02 ` [LTP] [PATCH 2/3] syscalls/pipe*: " Jinhui Huang
@ 2018-03-05 8:03 ` Petr Vorel
2018-03-06 1:41 ` jinhui huang
0 siblings, 1 reply; 8+ messages in thread
From: Petr Vorel @ 2018-03-05 8:03 UTC (permalink / raw)
To: ltp
Hi Jinhui,
> Signed-off-by: Jinhui Huang <huangjh.jy@cn.fujitsu.com>
> ---
> testcases/kernel/syscalls/pipe/pipe04.c | 2 +-
> testcases/kernel/syscalls/pipe/pipe05.c | 4 ++--
> testcases/kernel/syscalls/pipe/pipe07.c | 2 +-
> testcases/kernel/syscalls/pipe/pipe08.c | 2 ++
> testcases/kernel/syscalls/pipe/pipe11.c | 6 +++---
> 5 files changed, 9 insertions(+), 7 deletions(-)
> diff --git a/testcases/kernel/syscalls/pipe/pipe04.c b/testcases/kernel/syscalls/pipe/pipe04.c
> index b3d255b..a3c56e3 100644
> --- a/testcases/kernel/syscalls/pipe/pipe04.c
> +++ b/testcases/kernel/syscalls/pipe/pipe04.c
> @@ -235,7 +235,7 @@ void c2func(void)
> tst_resm(TBROK | TERRNO, "[child 2] pipe write failed");
> }
> -void alarmfunc(int sig)
> +void alarmfunc(int sig LTP_ATTRIBUTE_UNUSED)
> {
> /* for some reason tst_brkm doesn't seem to work in a signal handler */
> tst_brkm(TFAIL, cleanup, "one or more children did't die in 60 second "
> diff --git a/testcases/kernel/syscalls/pipe/pipe05.c b/testcases/kernel/syscalls/pipe/pipe05.c
> index fe5ec37..4105988 100644
> --- a/testcases/kernel/syscalls/pipe/pipe05.c
> +++ b/testcases/kernel/syscalls/pipe/pipe05.c
> @@ -59,7 +59,7 @@ void sig11_handler(int sig);
> int main(int ac, char **av)
> {
> - int lc;
> + volatile int lc;
Why volatile?
> struct sigaction sa, osa;
> tst_parse_opts(ac, av, NULL, NULL);
> @@ -120,7 +120,7 @@ void setup(void)
> /******************************************************************
> * sig11_handler() - our segfault recover hack
> ******************************************************************/
> -void sig11_handler(int sig)
> +void sig11_handler(int sig LTP_ATTRIBUTE_UNUSED)
> {
> longjmp(sig11_recover, 1);
> }
> diff --git a/testcases/kernel/syscalls/pipe/pipe07.c b/testcases/kernel/syscalls/pipe/pipe07.c
> index b09df71..55bb9f4 100644
> --- a/testcases/kernel/syscalls/pipe/pipe07.c
> +++ b/testcases/kernel/syscalls/pipe/pipe07.c
> @@ -129,7 +129,7 @@ static void record_open_fds(void)
> if (fd == dir_fd)
> continue;
> - if (rec_fds_max >= ARRAY_SIZE(rec_fds)) {
> + if (rec_fds_max >= (int)ARRAY_SIZE(rec_fds)) {
> tst_brkm(TBROK, cleanup,
> "Too much file descriptors open");
> }
> diff --git a/testcases/kernel/syscalls/pipe/pipe08.c b/testcases/kernel/syscalls/pipe/pipe08.c
> index cdb2a4d..9f8d9cc 100644
> --- a/testcases/kernel/syscalls/pipe/pipe08.c
> +++ b/testcases/kernel/syscalls/pipe/pipe08.c
> @@ -98,6 +98,8 @@ int main(int ac, char **av)
> * sent
> */
> written = write(pipefd[1], wrbuf, length);
> + if (written > 0)
> + tst_brkm(TBROK, cleanup, "write succeeded expectedly");
Did you mean "unexpectedly"?
> }
> cleanup();
> tst_exit();
> diff --git a/testcases/kernel/syscalls/pipe/pipe11.c b/testcases/kernel/syscalls/pipe/pipe11.c
> index e11c556..e3b2741 100644
> --- a/testcases/kernel/syscalls/pipe/pipe11.c
> +++ b/testcases/kernel/syscalls/pipe/pipe11.c
> @@ -198,7 +198,8 @@ void do_child_uclinux(void)
> */
> void setup(void)
> {
> - int i, j;
> + int i;
> + unsigned int j;
> tst_sig(FORK, DEF_HANDLER, cleanup);
> @@ -230,9 +231,8 @@ void setup(void)
> j = 0;
> for (i = 0; i < szcharbuf;) {
> wrbuf[i++] = rawchars[j++];
> - if (j >= sizeof(rawchars)) {
> + if (j >= sizeof(rawchars))
> j = 0;
> - }
> }
> }
Otherwise LGTM, thanks!
Kind regards,
Petr
^ permalink raw reply [flat|nested] 8+ messages in thread* [LTP] [PATCH 2/3] syscalls/pipe*: Fix compiler warnings
2018-03-05 8:03 ` Petr Vorel
@ 2018-03-06 1:41 ` jinhui huang
2018-03-06 15:03 ` Petr Vorel
0 siblings, 1 reply; 8+ messages in thread
From: jinhui huang @ 2018-03-06 1:41 UTC (permalink / raw)
To: ltp
于 2018/03/05 16:03, Petr Vorel 写道:
> Hi Jinhui,
>
>> Signed-off-by: Jinhui Huang<huangjh.jy@cn.fujitsu.com>
>> ---
>> testcases/kernel/syscalls/pipe/pipe04.c | 2 +-
>> testcases/kernel/syscalls/pipe/pipe05.c | 4 ++--
>> testcases/kernel/syscalls/pipe/pipe07.c | 2 +-
>> testcases/kernel/syscalls/pipe/pipe08.c | 2 ++
>> testcases/kernel/syscalls/pipe/pipe11.c | 6 +++---
>> 5 files changed, 9 insertions(+), 7 deletions(-)
>> diff --git a/testcases/kernel/syscalls/pipe/pipe04.c b/testcases/kernel/syscalls/pipe/pipe04.c
>> index b3d255b..a3c56e3 100644
>> --- a/testcases/kernel/syscalls/pipe/pipe04.c
>> +++ b/testcases/kernel/syscalls/pipe/pipe04.c
>> @@ -235,7 +235,7 @@ void c2func(void)
>> tst_resm(TBROK | TERRNO, "[child 2] pipe write failed");
>> }
>> -void alarmfunc(int sig)
>> +void alarmfunc(int sig LTP_ATTRIBUTE_UNUSED)
>> {
>> /* for some reason tst_brkm doesn't seem to work in a signal handler */
>> tst_brkm(TFAIL, cleanup, "one or more children did't die in 60 second "
>> diff --git a/testcases/kernel/syscalls/pipe/pipe05.c b/testcases/kernel/syscalls/pipe/pipe05.c
>> index fe5ec37..4105988 100644
>> --- a/testcases/kernel/syscalls/pipe/pipe05.c
>> +++ b/testcases/kernel/syscalls/pipe/pipe05.c
>> @@ -59,7 +59,7 @@ void sig11_handler(int sig);
>> int main(int ac, char **av)
>> {
>> - int lc;
>> + volatile int lc;
> Why volatile?
>
Hi Petr,
The compiler warning:
pipe05.c: In function ‘main’:
pipe05.c:62:6: warning: variable ‘lc’ might be clobbered by ‘longjmp’ or
‘vfork’ [-Wclobbered]
int lc;
We may avoid this warning by declaring "lc" as volatile which tells the
optimizer not to optimize it.
>> struct sigaction sa, osa;
>> tst_parse_opts(ac, av, NULL, NULL);
>> @@ -120,7 +120,7 @@ void setup(void)
>> /******************************************************************
>> * sig11_handler() - our segfault recover hack
>> ******************************************************************/
>> -void sig11_handler(int sig)
>> +void sig11_handler(int sig LTP_ATTRIBUTE_UNUSED)
>> {
>> longjmp(sig11_recover, 1);
>> }
>> diff --git a/testcases/kernel/syscalls/pipe/pipe07.c b/testcases/kernel/syscalls/pipe/pipe07.c
>> index b09df71..55bb9f4 100644
>> --- a/testcases/kernel/syscalls/pipe/pipe07.c
>> +++ b/testcases/kernel/syscalls/pipe/pipe07.c
>> @@ -129,7 +129,7 @@ static void record_open_fds(void)
>> if (fd == dir_fd)
>> continue;
>> - if (rec_fds_max>= ARRAY_SIZE(rec_fds)) {
>> + if (rec_fds_max>= (int)ARRAY_SIZE(rec_fds)) {
>> tst_brkm(TBROK, cleanup,
>> "Too much file descriptors open");
>> }
>> diff --git a/testcases/kernel/syscalls/pipe/pipe08.c b/testcases/kernel/syscalls/pipe/pipe08.c
>> index cdb2a4d..9f8d9cc 100644
>> --- a/testcases/kernel/syscalls/pipe/pipe08.c
>> +++ b/testcases/kernel/syscalls/pipe/pipe08.c
>> @@ -98,6 +98,8 @@ int main(int ac, char **av)
>> * sent
>> */
>> written = write(pipefd[1], wrbuf, length);
>> + if (written> 0)
>> + tst_brkm(TBROK, cleanup, "write succeeded expectedly");
> Did you mean "unexpectedly"?
>
Yes.
Best regards,
Jinhui
>> }
>> cleanup();
>> tst_exit();
>> diff --git a/testcases/kernel/syscalls/pipe/pipe11.c b/testcases/kernel/syscalls/pipe/pipe11.c
>> index e11c556..e3b2741 100644
>> --- a/testcases/kernel/syscalls/pipe/pipe11.c
>> +++ b/testcases/kernel/syscalls/pipe/pipe11.c
>> @@ -198,7 +198,8 @@ void do_child_uclinux(void)
>> */
>> void setup(void)
>> {
>> - int i, j;
>> + int i;
>> + unsigned int j;
>> tst_sig(FORK, DEF_HANDLER, cleanup);
>> @@ -230,9 +231,8 @@ void setup(void)
>> j = 0;
>> for (i = 0; i< szcharbuf;) {
>> wrbuf[i++] = rawchars[j++];
>> - if (j>= sizeof(rawchars)) {
>> + if (j>= sizeof(rawchars))
>> j = 0;
>> - }
>> }
>> }
> Otherwise LGTM, thanks!
>
>
> Kind regards,
> Petr
>
>
> .
>
^ permalink raw reply [flat|nested] 8+ messages in thread* [LTP] [PATCH 2/3] syscalls/pipe*: Fix compiler warnings
2018-03-06 1:41 ` jinhui huang
@ 2018-03-06 15:03 ` Petr Vorel
0 siblings, 0 replies; 8+ messages in thread
From: Petr Vorel @ 2018-03-06 15:03 UTC (permalink / raw)
To: ltp
Hi Jinhui,
> > > Signed-off-by: Jinhui Huang<huangjh.jy@cn.fujitsu.com>
> > > ---
> > > testcases/kernel/syscalls/pipe/pipe04.c | 2 +-
> > > testcases/kernel/syscalls/pipe/pipe05.c | 4 ++--
> > > testcases/kernel/syscalls/pipe/pipe07.c | 2 +-
> > > testcases/kernel/syscalls/pipe/pipe08.c | 2 ++
> > > testcases/kernel/syscalls/pipe/pipe11.c | 6 +++---
> > > 5 files changed, 9 insertions(+), 7 deletions(-)
...
> Hi Petr,
> The compiler warning:
> pipe05.c: In function ‘main’:
> pipe05.c:62:6: warning: variable ‘lc’ might be clobbered by ‘longjmp’ or
> ‘vfork’ [-Wclobbered]
> int lc;
> We may avoid this warning by declaring "lc" as volatile which tells the
> optimizer not to optimize it.
Thanks for info. This was issued by gcc-4.x, that's why I didn't notice that.
I pushed the patch, thanks!
BTW these tests deserve rewriting into new API, that would be a big improvement.
Kind regards,
Petr
^ permalink raw reply [flat|nested] 8+ messages in thread
* [LTP] [PATCH 3/3] syscalls/mknod*: Fix compiler warnings
2018-03-02 8:02 [LTP] [PATCH 1/3] syscalls/fchmod*: Fix compiler warnings Jinhui Huang
2018-03-02 8:02 ` [LTP] [PATCH 2/3] syscalls/pipe*: " Jinhui Huang
@ 2018-03-02 8:02 ` Jinhui Huang
2018-03-05 9:21 ` Petr Vorel
2018-03-05 7:48 ` [LTP] [PATCH 1/3] syscalls/fchmod*: " Petr Vorel
2 siblings, 1 reply; 8+ messages in thread
From: Jinhui Huang @ 2018-03-02 8:02 UTC (permalink / raw)
To: ltp
Signed-off-by: Jinhui Huang <huangjh.jy@cn.fujitsu.com>
---
testcases/kernel/syscalls/mknod/mknod02.c | 2 +-
testcases/kernel/syscalls/mknod/mknod03.c | 2 +-
testcases/kernel/syscalls/mknod/mknod04.c | 2 +-
testcases/kernel/syscalls/mknod/mknod05.c | 2 +-
testcases/kernel/syscalls/mknod/mknod08.c | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/testcases/kernel/syscalls/mknod/mknod02.c b/testcases/kernel/syscalls/mknod/mknod02.c
index e5741c3..594473e 100644
--- a/testcases/kernel/syscalls/mknod/mknod02.c
+++ b/testcases/kernel/syscalls/mknod/mknod02.c
@@ -173,7 +173,7 @@ int main(int ac, char **av)
}
/* Change the directory back to temporary directory */
- chdir("..");
+ SAFE_CHDIR(cleanup, "..");
/*
* Invoke cleanup() to delete the test directories created
diff --git a/testcases/kernel/syscalls/mknod/mknod03.c b/testcases/kernel/syscalls/mknod/mknod03.c
index fc34686..2af66f7 100644
--- a/testcases/kernel/syscalls/mknod/mknod03.c
+++ b/testcases/kernel/syscalls/mknod/mknod03.c
@@ -172,7 +172,7 @@ int main(int ac, char **av)
}
/* Change the directory back to temporary directory */
- chdir("..");
+ SAFE_CHDIR(cleanup, "..");
/*
* Invoke cleanup() to delete the test directories created
diff --git a/testcases/kernel/syscalls/mknod/mknod04.c b/testcases/kernel/syscalls/mknod/mknod04.c
index 6a8e08e..e0123ec 100644
--- a/testcases/kernel/syscalls/mknod/mknod04.c
+++ b/testcases/kernel/syscalls/mknod/mknod04.c
@@ -172,7 +172,7 @@ int main(int ac, char **av)
}
/* Change the directory back to temporary directory */
- chdir("..");
+ SAFE_CHDIR(cleanup, "..");
/*
* Invoke cleanup() to delete the test directories created
diff --git a/testcases/kernel/syscalls/mknod/mknod05.c b/testcases/kernel/syscalls/mknod/mknod05.c
index a00a0e4..fbc5575 100644
--- a/testcases/kernel/syscalls/mknod/mknod05.c
+++ b/testcases/kernel/syscalls/mknod/mknod05.c
@@ -171,7 +171,7 @@ int main(int ac, char **av)
}
/* change the directory back to temporary directory */
- chdir("..");
+ SAFE_CHDIR(cleanup, "..");
/*
* Invoke cleanup() to delete the test directories created
diff --git a/testcases/kernel/syscalls/mknod/mknod08.c b/testcases/kernel/syscalls/mknod/mknod08.c
index 3cc24ab..8647fde 100644
--- a/testcases/kernel/syscalls/mknod/mknod08.c
+++ b/testcases/kernel/syscalls/mknod/mknod08.c
@@ -170,7 +170,7 @@ int main(int ac, char **av)
}
/* Change the directory back to temporary directory */
- chdir("..");
+ SAFE_CHDIR(cleanup, "..");
/*
* Invoke cleanup() to delete the test directories created
--
1.8.3.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [LTP] [PATCH 3/3] syscalls/mknod*: Fix compiler warnings
2018-03-02 8:02 ` [LTP] [PATCH 3/3] syscalls/mknod*: " Jinhui Huang
@ 2018-03-05 9:21 ` Petr Vorel
0 siblings, 0 replies; 8+ messages in thread
From: Petr Vorel @ 2018-03-05 9:21 UTC (permalink / raw)
To: ltp
Hi Jinhui,
> Signed-off-by: Jinhui Huang <huangjh.jy@cn.fujitsu.com>
> ---
> testcases/kernel/syscalls/mknod/mknod02.c | 2 +-
> testcases/kernel/syscalls/mknod/mknod03.c | 2 +-
> testcases/kernel/syscalls/mknod/mknod04.c | 2 +-
> testcases/kernel/syscalls/mknod/mknod05.c | 2 +-
> testcases/kernel/syscalls/mknod/mknod08.c | 2 +-
> 5 files changed, 5 insertions(+), 5 deletions(-)
> diff --git a/testcases/kernel/syscalls/mknod/mknod02.c b/testcases/kernel/syscalls/mknod/mknod02.c
> index e5741c3..594473e 100644
> --- a/testcases/kernel/syscalls/mknod/mknod02.c
> +++ b/testcases/kernel/syscalls/mknod/mknod02.c
> @@ -173,7 +173,7 @@ int main(int ac, char **av)
> }
> /* Change the directory back to temporary directory */
> - chdir("..");
> + SAFE_CHDIR(cleanup, "..");
> /*
> * Invoke cleanup() to delete the test directories created
> diff --git a/testcases/kernel/syscalls/mknod/mknod03.c b/testcases/kernel/syscalls/mknod/mknod03.c
> index fc34686..2af66f7 100644
> --- a/testcases/kernel/syscalls/mknod/mknod03.c
> +++ b/testcases/kernel/syscalls/mknod/mknod03.c
> @@ -172,7 +172,7 @@ int main(int ac, char **av)
> }
> /* Change the directory back to temporary directory */
> - chdir("..");
> + SAFE_CHDIR(cleanup, "..");
> /*
> * Invoke cleanup() to delete the test directories created
> diff --git a/testcases/kernel/syscalls/mknod/mknod04.c b/testcases/kernel/syscalls/mknod/mknod04.c
> index 6a8e08e..e0123ec 100644
> --- a/testcases/kernel/syscalls/mknod/mknod04.c
> +++ b/testcases/kernel/syscalls/mknod/mknod04.c
> @@ -172,7 +172,7 @@ int main(int ac, char **av)
> }
> /* Change the directory back to temporary directory */
> - chdir("..");
> + SAFE_CHDIR(cleanup, "..");
> /*
> * Invoke cleanup() to delete the test directories created
> diff --git a/testcases/kernel/syscalls/mknod/mknod05.c b/testcases/kernel/syscalls/mknod/mknod05.c
> index a00a0e4..fbc5575 100644
> --- a/testcases/kernel/syscalls/mknod/mknod05.c
> +++ b/testcases/kernel/syscalls/mknod/mknod05.c
> @@ -171,7 +171,7 @@ int main(int ac, char **av)
> }
> /* change the directory back to temporary directory */
> - chdir("..");
> + SAFE_CHDIR(cleanup, "..");
> /*
> * Invoke cleanup() to delete the test directories created
> diff --git a/testcases/kernel/syscalls/mknod/mknod08.c b/testcases/kernel/syscalls/mknod/mknod08.c
> index 3cc24ab..8647fde 100644
> --- a/testcases/kernel/syscalls/mknod/mknod08.c
> +++ b/testcases/kernel/syscalls/mknod/mknod08.c
> @@ -170,7 +170,7 @@ int main(int ac, char **av)
> }
> /* Change the directory back to temporary directory */
> - chdir("..");
> + SAFE_CHDIR(cleanup, "..");
> /*
> * Invoke cleanup() to delete the test directories created
Pushed, thanks!
Kind regards,
Petr
^ permalink raw reply [flat|nested] 8+ messages in thread
* [LTP] [PATCH 1/3] syscalls/fchmod*: Fix compiler warnings
2018-03-02 8:02 [LTP] [PATCH 1/3] syscalls/fchmod*: Fix compiler warnings Jinhui Huang
2018-03-02 8:02 ` [LTP] [PATCH 2/3] syscalls/pipe*: " Jinhui Huang
2018-03-02 8:02 ` [LTP] [PATCH 3/3] syscalls/mknod*: " Jinhui Huang
@ 2018-03-05 7:48 ` Petr Vorel
2 siblings, 0 replies; 8+ messages in thread
From: Petr Vorel @ 2018-03-05 7:48 UTC (permalink / raw)
To: ltp
Hi Jinhui,
> Signed-off-by: Jinhui Huang <huangjh.jy@cn.fujitsu.com>
> ---
> testcases/kernel/syscalls/fchmod/fchmod05.c | 4 ++--
> testcases/kernel/syscalls/fchmod/fchmod07.c | 4 ++--
> 2 files changed, 4 insertions(+), 4 deletions(-)
> diff --git a/testcases/kernel/syscalls/fchmod/fchmod05.c b/testcases/kernel/syscalls/fchmod/fchmod05.c
> index 7a27028..cdd3d07 100644
> --- a/testcases/kernel/syscalls/fchmod/fchmod05.c
> +++ b/testcases/kernel/syscalls/fchmod/fchmod05.c
> @@ -220,8 +220,8 @@ void cleanup(void)
> /* Close the test directory opened in the setup() */
> SAFE_CLOSE(NULL, fd);
> - setegid(0);
> - seteuid(0);
> + SAFE_SETEGID(NULL, 0);
> + SAFE_SETEUID(NULL, 0);
> tst_rmdir();
> diff --git a/testcases/kernel/syscalls/fchmod/fchmod07.c b/testcases/kernel/syscalls/fchmod/fchmod07.c
> index 66032e4..6973555 100644
> --- a/testcases/kernel/syscalls/fchmod/fchmod07.c
> +++ b/testcases/kernel/syscalls/fchmod/fchmod07.c
> @@ -83,7 +83,7 @@ int fd; /* file descriptor for testfile */
> char *TCID = "fchmod07";
> int TST_TOTAL = 8; /* Total number of test conditions */
> -int Modes[] = { 0, 07, 070, 0700, 0777, 02777, 04777, 06777 };
> +mode_t Modes[] = { 0, 07, 070, 0700, 0777, 02777, 04777, 06777 };
> void setup(); /* setup function for the test */
> void cleanup(); /* cleanup function for the test */
> @@ -93,7 +93,7 @@ int main(int ac, char **av)
> struct stat stat_buf; /* stat(2) struct contents */
> int lc;
> int ind; /* counter variable for chmod(2) tests */
> - int mode; /* file mode permission */
> + mode_t mode; /* file mode permission */
> TST_TOTAL = sizeof(Modes) / sizeof(int);
Pushed, thanks!
Kind regards,
Petr
^ permalink raw reply [flat|nested] 8+ messages in thread