From 196bb34af68e98e449b907355f60758888800b7e Mon Sep 17 00:00:00 2001 From: iakov Date: Thu, 10 Oct 2019 14:47:25 +0300 Subject: 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. --- singleapplication_p.cpp | 8 +++----- 1 file 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"); -- cgit v1.2.1