mirror of
https://github.com/itay-grudev/SingleApplication.git
synced 2025-01-15 00:42:05 +08:00
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.
This commit is contained in:
parent
e18babe559
commit
196bb34af6
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user