Merge pull request #326 from gnustep/warningfix

This commit is contained in:
Gregory Casamento 2023-09-20 16:51:25 -04:00 committed by GitHub
commit 92ef305e1e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 45 additions and 30 deletions

View file

@ -1880,9 +1880,16 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
- (void) truncateFileAtOffset: (unsigned long long)pos
{
if (isStandardFile && descriptor >= 0)
if (!(isStandardFile && descriptor >= 0))
{
(void)ftruncate(descriptor, pos);
[NSException raise: NSFileHandleOperationException
format: @"attempt to truncate invalid file"];
}
if (ftruncate(descriptor, pos) < 0)
{
[NSException raise: NSFileHandleOperationException
format: @"truncation failed"];
}
[self seekToFileOffset: pos];
}

View file

@ -1266,18 +1266,20 @@ static Class runLoopClass;
cLength = 0;
#if defined(HAVE_GNUTLS)
NSDictionary *opts = [p clientOptionsForTLS];
DESTROY(session);
if (opts)
{
session = [[GSTLSSession alloc] initWithOptions: opts
direction: YES // as client
transport: self
push: GSTLSHandlePush
pull: GSTLSHandlePull];
NSDebugMLLog(@"GSTcpHandle",
@"%@ is connecting using %@", self, session);
}
{
NSDictionary *opts = [p clientOptionsForTLS];
DESTROY(session);
if (opts)
{
session = [[GSTLSSession alloc] initWithOptions: opts
direction: YES // as client
transport: self
push: GSTLSHandlePush
pull: GSTLSHandlePull];
NSDebugMLLog(@"GSTcpHandle",
@"%@ is connecting using %@", self, session);
}
}
#endif
}
}
@ -2425,18 +2427,20 @@ static Class tcpPortClass;
ASSIGN(handle->defaultAddress, GSPrivateSockaddrHost(&sockAddr));
[handle setState: GS_H_ACCEPT];
#if defined(HAVE_GNUTLS)
NSDictionary *o;
if ((o = [self serverOptionsForTLS]) != nil)
{
handle->session = [[GSTLSSession alloc]
initWithOptions: o
direction: NO // as server
transport: handle
push: GSTLSHandlePush
pull: GSTLSHandlePull];
NSDebugMLLog(@"GSTcpHandle",
@"%@ is accepting using %@", handle, handle->session);
}
{
NSDictionary *o;
if ((o = [self serverOptionsForTLS]) != nil)
{
handle->session = [[GSTLSSession alloc]
initWithOptions: o
direction: NO // as server
transport: handle
push: GSTLSHandlePush
pull: GSTLSHandlePull];
NSDebugMLLog(@"GSTcpHandle",
@"%@ is accepting using %@", handle, handle->session);
}
}
#endif
[self addHandle: handle forSend: NO];
}

View file

@ -420,7 +420,7 @@ pty_slave(const char* name)
if (NO == [self launchAndReturnError: &e])
{
[NSException raise: NSInvalidArgumentException
format: @"%@", e ? e : @"Unable to launch"];
format: @"%@", e ? [e description] : @"Unable to launch"];
}
}
@ -969,7 +969,7 @@ pty_slave(const char* name)
coalesceMask: NSNotificationNoCoalescing
forModes: nil];
if (_handler != nil)
if (_handler != NULL)
{
CALL_BLOCK_NO_ARGS(_handler);
}
@ -1733,7 +1733,11 @@ GSPrivateCheckTasks()
(void) close(i);
}
(void)chdir(path);
if (0 != chdir(path))
{
exit(-1);
}
(void)execve(executable, (char**)args, (char**)envl);
exit(-1);
}

View file

@ -2971,7 +2971,7 @@ newDetailInZoneForType(GSTimeZone *zone, TypeInfo *type)
static TypeInfo
getTypeInfo(NSTimeInterval since, GSTimeZone *zone)
{
int64_t when = (int64_t)since;
time_t when = (time_t)since;
gstm tm;
TypeInfo type;