Skip to content

Commit

Permalink
Fix compilation warning/error (#74)
Browse files Browse the repository at this point in the history
Fix `comparison between signed and unsigned integer expressions` problem.
User ID is a positive integer  in Linux/UNIX(macOS, FreeBSD, Solaris), also `geteuid()` never fails with return code.
  • Loading branch information
iakov authored and itay-grudev committed Oct 10, 2019
1 parent e18babe commit 196bb34
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions singleapplication_p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,9 @@ void SingleApplicationPrivate::genBlockServerName()
#ifdef Q_OS_UNIX
QByteArray username;
uid_t uid = geteuid();
if( uid != -1 ) {
struct passwd *pw = getpwuid(uid);
if( pw ) {
username = pw->pw_name;
}
struct passwd *pw = getpwuid(uid);
if( pw ) {
username = pw->pw_name;
}
if( username.isEmpty() ) {
username = qgetenv("USER");
Expand Down

0 comments on commit 196bb34

Please sign in to comment.