1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

cov: ignore syscall

This commit is contained in:
Zdenek Kabelac 2021-09-20 01:45:55 +02:00
parent 055406bb39
commit efaab93491
6 changed files with 38 additions and 38 deletions

View File

@ -919,7 +919,7 @@ static void write_adopt_file(void)
pthread_mutex_unlock(&lockspaces_mutex);
fflush(fp);
fclose(fp);
(void) fclose(fp);
}
static int read_adopt_file(struct list_head *vg_lockd)
@ -1010,11 +1010,11 @@ static int read_adopt_file(struct list_head *vg_lockd)
}
}
fclose(fp);
(void) fclose(fp);
return 0;
fail:
fclose(fp);
(void) fclose(fp);
return -1;
}

View File

@ -734,7 +734,7 @@ static void _block_remove(struct block *b)
k.parts.di = b->di;
k.parts.b = b->index;
radix_tree_remove(b->cache->rtree, k.bytes, k.bytes + sizeof(k.bytes));
(void) radix_tree_remove(b->cache->rtree, k.bytes, k.bytes + sizeof(k.bytes));
}
//----------------------------------------------------------------

View File

@ -102,7 +102,7 @@ struct dir {
if ( !d )
throw syserr( "error opening directory", p );
}
~dir() { closedir( d ); }
~dir() { (void) closedir( d ); }
};
typedef std::vector< std::string > Listing;
@ -111,8 +111,8 @@ inline void fsync_name( std::string n )
{
int fd = open( n.c_str(), O_WRONLY );
if ( fd >= 0 ) {
fsync( fd );
close( fd );
(void) fsync( fd );
(void) close( fd );
}
}
@ -464,8 +464,8 @@ struct FileSink : FdSink {
~FileSink() {
if ( fd >= 0 ) {
fsync( fd );
close( fd );
(void) fsync( fd );
(void) close( fd );
}
}
};
@ -515,7 +515,7 @@ struct Source {
Source( int _fd = -1 ) : fd( _fd ) {}
virtual ~Source() {
if ( fd >= 0 )
::close( fd );
(void) ::close( fd );
}
};
@ -570,7 +570,7 @@ struct KMsg : Source {
can_clear = false;
} else if ( lseek( fd, 0L, SEEK_END ) == (off_t) -1 ) {
fprintf( stderr, "lseek log %s %s\n", read_msg, strerror( errno ) );
close(fd);
(void) close(fd);
fd = -1;
}
#endif
@ -712,13 +712,13 @@ struct TestProcess
if ( !interactive ) {
int devnull = ::open( "/dev/null", O_RDONLY );
if ( devnull >= 0 ) { /* gcc really doesn't like to not have stdin */
dup2( devnull, STDIN_FILENO );
close( devnull );
(void) dup2( devnull, STDIN_FILENO );
(void) close( devnull );
} else
close( STDIN_FILENO );
dup2( fd, STDOUT_FILENO );
dup2( fd, STDERR_FILENO );
close( fd );
(void) close( STDIN_FILENO );
(void) dup2( fd, STDOUT_FILENO );
(void) dup2( fd, STDERR_FILENO );
(void) close( fd );
}
setpgid( 0, 0 );
@ -804,7 +804,7 @@ struct TestCase {
if ( waitpid( pid, &status, WNOHANG ) == 0 ) {
system( "echo t > /proc/sysrq-trigger 2> /dev/null" );
kill( -pid, SIGKILL );
waitpid( pid, &status, 0 );
(void) waitpid( pid, &status, 0 );
}
timeout = true;
io.sync( true );
@ -897,7 +897,7 @@ struct TestCase {
void parent()
{
::close( child.fd );
(void) ::close( child.fd );
setupIO();
journal->started( id() );
@ -957,9 +957,9 @@ struct TestCase {
exit(201);
} else if (pid == 0) {
io.close();
chdir( options.workdir.c_str() );
(void) chdir( options.workdir.c_str() );
if ( !options.flavour_envvar.empty() )
setenv( options.flavour_envvar.c_str(), flavour.c_str(), 1 );
(void) setenv( options.flavour_envvar.c_str(), flavour.c_str(), 1 );
child.exec();
} else {
parent();
@ -1053,7 +1053,7 @@ struct Main {
if ( options.cont )
journal.read();
else
::unlink( journal.location.c_str() );
(void) ::unlink( journal.location.c_str() );
}
int run() {

View File

@ -80,7 +80,7 @@ int main(int args, char **argv) {
val = "5";
if (val)
setenv("LVM_EXPECTED_EXIT_STATUS", val, 1);
(void) setenv("LVM_EXPECTED_EXIT_STATUS", val, 1);
execvp(argv[1], &argv[1]);
/* should not be accessible */

View File

@ -185,7 +185,7 @@ static const char *_fake_lvmconfig(const char *output)
fprintf(fp, "%s", output);
fprintf(fp, "EOF\n");
fclose(fp);
(void) fclose(fp);
if (chmod(path, 0770))
test_fail("chmod 0777 failed on path %s", path);
@ -234,7 +234,7 @@ static void _test_get_config(void *fixture)
test_fail("_get_config() <- '%s' unexpectedly succeeded", t->output);
}
unlink(path);
(void) unlink(path);
}
}

View File

@ -31,25 +31,25 @@ static void test_percent_100(void *fixture)
T_ASSERT_EQUAL(p1_100, DM_PERCENT_100);
T_ASSERT_NOT_EQUAL(n_100, DM_PERCENT_100);
dm_snprintf(buf, sizeof(buf), "%.2f", dm_percent_to_float(p_100));
(void) dm_snprintf(buf, sizeof(buf), "%.2f", dm_percent_to_float(p_100));
T_ASSERT_EQUAL(strcmp(buf, "100.00"), 0);
dm_snprintf(buf, sizeof(buf), "%.2f", dm_percent_to_float(p1_100));
(void) dm_snprintf(buf, sizeof(buf), "%.2f", dm_percent_to_float(p1_100));
T_ASSERT_EQUAL(strcmp(buf, "100.00"), 0);
dm_snprintf(buf, sizeof(buf), "%.2f", dm_percent_to_float(n_100));
(void) dm_snprintf(buf, sizeof(buf), "%.2f", dm_percent_to_float(n_100));
T_ASSERT_NOT_EQUAL(strcmp(buf, "99.99"), 0); /* Would like to gett */
dm_snprintf(buf, sizeof(buf), "%.2f", dm_percent_to_round_float(n_100, 2));
(void) dm_snprintf(buf, sizeof(buf), "%.2f", dm_percent_to_round_float(n_100, 2));
T_ASSERT_EQUAL(strcmp(buf, "99.99"), 0);
dm_snprintf(buf, sizeof(buf), "%.3f", dm_percent_to_round_float(n_100, 3));
(void) dm_snprintf(buf, sizeof(buf), "%.3f", dm_percent_to_round_float(n_100, 3));
T_ASSERT_EQUAL(strcmp(buf, "99.999"), 0);
dm_snprintf(buf, sizeof(buf), "%.4f", dm_percent_to_round_float(n_100, 4));
(void) dm_snprintf(buf, sizeof(buf), "%.4f", dm_percent_to_round_float(n_100, 4));
T_ASSERT_EQUAL(strcmp(buf, "99.9999"), 0);
dm_snprintf(buf, sizeof(buf), "%d", (int)dm_percent_to_round_float(n_100, 0));
(void) dm_snprintf(buf, sizeof(buf), "%d", (int)dm_percent_to_round_float(n_100, 0));
T_ASSERT_EQUAL(strcmp(buf, "99"), 0);
}
@ -66,22 +66,22 @@ static void test_percent_0(void *fixture)
T_ASSERT_EQUAL(p1_0, DM_PERCENT_0);
T_ASSERT_NOT_EQUAL(n_0, DM_PERCENT_0);
dm_snprintf(buf, sizeof(buf), "%.2f", dm_percent_to_float(p_0));
(void) dm_snprintf(buf, sizeof(buf), "%.2f", dm_percent_to_float(p_0));
T_ASSERT_EQUAL(strcmp(buf, "0.00"), 0);
dm_snprintf(buf, sizeof(buf), "%.2f", dm_percent_to_float(p1_0));
(void) dm_snprintf(buf, sizeof(buf), "%.2f", dm_percent_to_float(p1_0));
T_ASSERT_EQUAL(strcmp(buf, "0.00"), 0);
dm_snprintf(buf, sizeof(buf), "%.2f", dm_percent_to_float(n_0));
(void) dm_snprintf(buf, sizeof(buf), "%.2f", dm_percent_to_float(n_0));
T_ASSERT_NOT_EQUAL(strcmp(buf, "0.01"), 0);
dm_snprintf(buf, sizeof(buf), "%.2f", dm_percent_to_round_float(n_0, 2));
(void) dm_snprintf(buf, sizeof(buf), "%.2f", dm_percent_to_round_float(n_0, 2));
T_ASSERT_EQUAL(strcmp(buf, "0.01"), 0);
dm_snprintf(buf, sizeof(buf), "%.3f", dm_percent_to_round_float(n_0, 3));
(void) dm_snprintf(buf, sizeof(buf), "%.3f", dm_percent_to_round_float(n_0, 3));
T_ASSERT_EQUAL(strcmp(buf, "0.001"), 0);
dm_snprintf(buf, sizeof(buf), "%d", (int)dm_percent_to_round_float(n_0, 0));
(void) dm_snprintf(buf, sizeof(buf), "%d", (int)dm_percent_to_round_float(n_0, 0));
T_ASSERT_EQUAL(strcmp(buf, "1"), 0);
}