Coverity doesn't like the fopen(3) after stat(2). This is test code
that runs in a simple test environment, so this doesn't really matter.
However, reorder the code to put the stat(2) after the fopen(3). This
means that the test still does all the same checks and it should now
make Coverity happy.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Anoop C S <anoopcs@samba.org>
assert(ret == 0);
assert(pid_ctx != NULL);
- ret = stat(pidfile, &st);
- assert(ret == 0);
- assert(S_ISREG(st.st_mode));
-
fp = fopen(pidfile, "r");
assert(fp != NULL);
ret = fscanf(fp, "%d", &pid);
assert(pid == getpid());
fclose(fp);
+ ret = stat(pidfile, &st);
+ assert(ret == 0);
+ assert(S_ISREG(st.st_mode));
+
TALLOC_FREE(pid_ctx);
ret = stat(pidfile, &st);