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:
parent
055406bb39
commit
efaab93491
@ -919,7 +919,7 @@ static void write_adopt_file(void)
|
|||||||
pthread_mutex_unlock(&lockspaces_mutex);
|
pthread_mutex_unlock(&lockspaces_mutex);
|
||||||
|
|
||||||
fflush(fp);
|
fflush(fp);
|
||||||
fclose(fp);
|
(void) fclose(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int read_adopt_file(struct list_head *vg_lockd)
|
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;
|
return 0;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
fclose(fp);
|
(void) fclose(fp);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -734,7 +734,7 @@ static void _block_remove(struct block *b)
|
|||||||
k.parts.di = b->di;
|
k.parts.di = b->di;
|
||||||
k.parts.b = b->index;
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
||||||
|
@ -102,7 +102,7 @@ struct dir {
|
|||||||
if ( !d )
|
if ( !d )
|
||||||
throw syserr( "error opening directory", p );
|
throw syserr( "error opening directory", p );
|
||||||
}
|
}
|
||||||
~dir() { closedir( d ); }
|
~dir() { (void) closedir( d ); }
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector< std::string > Listing;
|
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 );
|
int fd = open( n.c_str(), O_WRONLY );
|
||||||
if ( fd >= 0 ) {
|
if ( fd >= 0 ) {
|
||||||
fsync( fd );
|
(void) fsync( fd );
|
||||||
close( fd );
|
(void) close( fd );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -464,8 +464,8 @@ struct FileSink : FdSink {
|
|||||||
|
|
||||||
~FileSink() {
|
~FileSink() {
|
||||||
if ( fd >= 0 ) {
|
if ( fd >= 0 ) {
|
||||||
fsync( fd );
|
(void) fsync( fd );
|
||||||
close( fd );
|
(void) close( fd );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -515,7 +515,7 @@ struct Source {
|
|||||||
Source( int _fd = -1 ) : fd( _fd ) {}
|
Source( int _fd = -1 ) : fd( _fd ) {}
|
||||||
virtual ~Source() {
|
virtual ~Source() {
|
||||||
if ( fd >= 0 )
|
if ( fd >= 0 )
|
||||||
::close( fd );
|
(void) ::close( fd );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -570,7 +570,7 @@ struct KMsg : Source {
|
|||||||
can_clear = false;
|
can_clear = false;
|
||||||
} else if ( lseek( fd, 0L, SEEK_END ) == (off_t) -1 ) {
|
} else if ( lseek( fd, 0L, SEEK_END ) == (off_t) -1 ) {
|
||||||
fprintf( stderr, "lseek log %s %s\n", read_msg, strerror( errno ) );
|
fprintf( stderr, "lseek log %s %s\n", read_msg, strerror( errno ) );
|
||||||
close(fd);
|
(void) close(fd);
|
||||||
fd = -1;
|
fd = -1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -712,13 +712,13 @@ struct TestProcess
|
|||||||
if ( !interactive ) {
|
if ( !interactive ) {
|
||||||
int devnull = ::open( "/dev/null", O_RDONLY );
|
int devnull = ::open( "/dev/null", O_RDONLY );
|
||||||
if ( devnull >= 0 ) { /* gcc really doesn't like to not have stdin */
|
if ( devnull >= 0 ) { /* gcc really doesn't like to not have stdin */
|
||||||
dup2( devnull, STDIN_FILENO );
|
(void) dup2( devnull, STDIN_FILENO );
|
||||||
close( devnull );
|
(void) close( devnull );
|
||||||
} else
|
} else
|
||||||
close( STDIN_FILENO );
|
(void) close( STDIN_FILENO );
|
||||||
dup2( fd, STDOUT_FILENO );
|
(void) dup2( fd, STDOUT_FILENO );
|
||||||
dup2( fd, STDERR_FILENO );
|
(void) dup2( fd, STDERR_FILENO );
|
||||||
close( fd );
|
(void) close( fd );
|
||||||
}
|
}
|
||||||
|
|
||||||
setpgid( 0, 0 );
|
setpgid( 0, 0 );
|
||||||
@ -804,7 +804,7 @@ struct TestCase {
|
|||||||
if ( waitpid( pid, &status, WNOHANG ) == 0 ) {
|
if ( waitpid( pid, &status, WNOHANG ) == 0 ) {
|
||||||
system( "echo t > /proc/sysrq-trigger 2> /dev/null" );
|
system( "echo t > /proc/sysrq-trigger 2> /dev/null" );
|
||||||
kill( -pid, SIGKILL );
|
kill( -pid, SIGKILL );
|
||||||
waitpid( pid, &status, 0 );
|
(void) waitpid( pid, &status, 0 );
|
||||||
}
|
}
|
||||||
timeout = true;
|
timeout = true;
|
||||||
io.sync( true );
|
io.sync( true );
|
||||||
@ -897,7 +897,7 @@ struct TestCase {
|
|||||||
|
|
||||||
void parent()
|
void parent()
|
||||||
{
|
{
|
||||||
::close( child.fd );
|
(void) ::close( child.fd );
|
||||||
setupIO();
|
setupIO();
|
||||||
|
|
||||||
journal->started( id() );
|
journal->started( id() );
|
||||||
@ -957,9 +957,9 @@ struct TestCase {
|
|||||||
exit(201);
|
exit(201);
|
||||||
} else if (pid == 0) {
|
} else if (pid == 0) {
|
||||||
io.close();
|
io.close();
|
||||||
chdir( options.workdir.c_str() );
|
(void) chdir( options.workdir.c_str() );
|
||||||
if ( !options.flavour_envvar.empty() )
|
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();
|
child.exec();
|
||||||
} else {
|
} else {
|
||||||
parent();
|
parent();
|
||||||
@ -1053,7 +1053,7 @@ struct Main {
|
|||||||
if ( options.cont )
|
if ( options.cont )
|
||||||
journal.read();
|
journal.read();
|
||||||
else
|
else
|
||||||
::unlink( journal.location.c_str() );
|
(void) ::unlink( journal.location.c_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
int run() {
|
int run() {
|
||||||
|
@ -80,7 +80,7 @@ int main(int args, char **argv) {
|
|||||||
val = "5";
|
val = "5";
|
||||||
|
|
||||||
if (val)
|
if (val)
|
||||||
setenv("LVM_EXPECTED_EXIT_STATUS", val, 1);
|
(void) setenv("LVM_EXPECTED_EXIT_STATUS", val, 1);
|
||||||
|
|
||||||
execvp(argv[1], &argv[1]);
|
execvp(argv[1], &argv[1]);
|
||||||
/* should not be accessible */
|
/* should not be accessible */
|
||||||
|
@ -185,7 +185,7 @@ static const char *_fake_lvmconfig(const char *output)
|
|||||||
fprintf(fp, "%s", output);
|
fprintf(fp, "%s", output);
|
||||||
fprintf(fp, "EOF\n");
|
fprintf(fp, "EOF\n");
|
||||||
|
|
||||||
fclose(fp);
|
(void) fclose(fp);
|
||||||
if (chmod(path, 0770))
|
if (chmod(path, 0770))
|
||||||
test_fail("chmod 0777 failed on path %s", path);
|
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);
|
test_fail("_get_config() <- '%s' unexpectedly succeeded", t->output);
|
||||||
}
|
}
|
||||||
|
|
||||||
unlink(path);
|
(void) unlink(path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,25 +31,25 @@ static void test_percent_100(void *fixture)
|
|||||||
T_ASSERT_EQUAL(p1_100, DM_PERCENT_100);
|
T_ASSERT_EQUAL(p1_100, DM_PERCENT_100);
|
||||||
T_ASSERT_NOT_EQUAL(n_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);
|
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);
|
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 */
|
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);
|
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);
|
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);
|
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);
|
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_EQUAL(p1_0, DM_PERCENT_0);
|
||||||
T_ASSERT_NOT_EQUAL(n_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);
|
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);
|
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);
|
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);
|
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);
|
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);
|
T_ASSERT_EQUAL(strcmp(buf, "1"), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user