Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix another bunch of warnings
  • Loading branch information
jef-n committed Sep 8, 2013
1 parent 5d093f4 commit c9fe92c
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 13 deletions.
5 changes: 4 additions & 1 deletion src/plugins/grass/qtermwidget/BlockArray.cpp
Expand Up @@ -211,7 +211,10 @@ bool BlockArray::setHistorySize( size_t newsize )
else
{
decreaseBuffer( newsize );
( void ) ftruncate( ion, length*blocksize );
if( ftruncate( ion, length*blocksize ) < 0 )
{
perror( "ftruncate" );
}
size = newsize;

return true;
Expand Down
12 changes: 8 additions & 4 deletions src/plugins/grass/qtermwidget/k3process.cpp
Expand Up @@ -151,7 +151,8 @@ K3Process::setupEnvironment()
}
if ( !d->wd.isEmpty() )
{
( void ) chdir( QFile::encodeName( d->wd ).data() );
if( chdir( QFile::encodeName( d->wd ).data() ) < 0 )
perror( "chdir" );
}
}

Expand Down Expand Up @@ -334,13 +335,15 @@ bool K3Process::start( RunMode runmode, Communication comm )

if ( !runPrivileged() )
{
setgid( getgid() );
if( setgid( getgid() ) < 0 )
perror( "setgid" );
#ifdef HAVE_INITGROUPS
if ( pw )
initgroups( pw->pw_name, pw->pw_gid );
#endif
if ( geteuid() != getuid() )
setuid( getuid() );
if( setuid( getuid() ) < 0 )
perror( "setuid" );
if ( geteuid() != getuid() )
_exit( 1 );
}
Expand All @@ -356,7 +359,8 @@ bool K3Process::start( RunMode runmode, Communication comm )
execvp( executable, arglist );

char resultByte = 1;
( void ) write( fd[1], &resultByte, 1 );
if( write( fd[1], &resultByte, 1 ) < 0 )
perror( "write" );
_exit( -1 );
}
else if ( pid_ == -1 )
Expand Down
9 changes: 6 additions & 3 deletions src/plugins/grass/qtermwidget/k3processcontroller.cpp
Expand Up @@ -209,7 +209,8 @@ void K3ProcessController::theSigCHLDHandler( int arg )
int saved_errno = errno;

char dummy = 0;
( void ) ::write( instance()->d->fd[1], &dummy, 1 );
if( ::write( instance()->d->fd[1], &dummy, 1 ) < 0 )
perror( "write failed" );

#ifdef Q_OS_UNIX
if ( Private::oldChildHandlerData.sa_handler != SIG_IGN &&
Expand Down Expand Up @@ -243,14 +244,16 @@ K3ProcessController::rescheduleCheck()
{
d->needcheck = false;
char dummy = 0;
( void ) ::write( d->fd[1], &dummy, 1 );
if( ::write( d->fd[1], &dummy, 1 ) < 0 )
perror( "write failed" );
}
}

void K3ProcessController::slotDoHousekeeping()
{
char dummy[16]; // somewhat bigger - just in case several have queued up
( void ) ::read( d->fd[0], dummy, sizeof( dummy ) );
if( ::read( d->fd[0], dummy, sizeof( dummy ) ) < 0 )
perror( "read failed" );

int status;
again:
Expand Down
9 changes: 6 additions & 3 deletions src/plugins/grass/qtermwidget/kpty.cpp
Expand Up @@ -303,8 +303,10 @@ bool KPty::open()
p = getgrnam( "wheel" );
gid_t gid = p ? p->gr_gid : getgid();

( void ) chown( d->ttyName.data(), getuid(), gid );
( void ) chmod( d->ttyName.data(), S_IRUSR | S_IWUSR | S_IWGRP );
if( chown( d->ttyName.data(), getuid(), gid ) < 0 )
perror( "chown" );
if( chmod( d->ttyName.data(), S_IRUSR | S_IWUSR | S_IWGRP ) < 0 )
perror( "chmod" );
}
goto gotpty;
}
Expand Down Expand Up @@ -397,7 +399,8 @@ void KPty::close()
struct stat st;
if ( !stat( d->ttyName.data(), &st ) )
{
( void ) chown( d->ttyName.data(), 0, st.st_gid == getgid() ? 0 : -1 );
if( chown( d->ttyName.data(), 0, st.st_gid == getgid() ? 0 : -1 ) < 0 )
perror( "chown" );
chmod( d->ttyName.data(), S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH );
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/providers/gpx/qgsgpxfeatureiterator.cpp
Expand Up @@ -431,7 +431,7 @@ QgsGeometry* QgsGPXFeatureIterator::readTrackGeometry( const QgsTrack& trk )

// A track consists of several segments. Add all those segments into one.
int totalPoints = 0;;
for ( std::vector<QgsTrackSegment>::size_type i = 0; i < trk.segments.size(); i ++ )
for ( int i = 0; i < trk.segments.size(); i ++ )
{
totalPoints += trk.segments[i].points.size();
}
Expand All @@ -452,7 +452,7 @@ QgsGeometry* QgsGPXFeatureIterator::readTrackGeometry( const QgsTrack& trk )
std::memcpy( geo + 5, &totalPoints, 4 );

int thisPoint = 0;
for ( std::vector<QgsTrackSegment>::size_type k = 0; k < trk.segments.size(); k++ )
for ( int k = 0; k < trk.segments.size(); k++ )
{
int nPoints = trk.segments[k].points.size();
for ( int i = 0; i < nPoints; ++i )
Expand Down

0 comments on commit c9fe92c

Please sign in to comment.