diff options
author | iakov <iakov@users.noreply.github.com> | 2019-10-10 14:47:25 +0300 |
---|---|---|
committer | Itay Grudev <itay+89bf5c@grudev.com> | 2019-10-10 14:47:25 +0300 |
commit | 196bb34af68e98e449b907355f60758888800b7e (patch) | |
tree | 139d917f04ebb3e41435d0b392e8a7002992e039 | |
parent | Update CHANGELOG.md (diff) | |
download | singleapplication-196bb34af68e98e449b907355f60758888800b7e.tar.xz |
Fix compilation warning/error (#74)
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.
-rw-r--r-- | singleapplication_p.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/singleapplication_p.cpp b/singleapplication_p.cpp index a129aa0..884fe63 100644 --- a/singleapplication_p.cpp +++ b/singleapplication_p.cpp @@ -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"); |