Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 35 additions & 8 deletions westeros-compositor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5675,9 +5675,12 @@ static WstSurface* wstSurfaceCreate( WstCompositor *wctx)
wstSurfaceInsertSurface( ctx, surface );
}
#ifdef ENABLE_LEXPSYNCPROTOCOL
WstLExpSyncClear(&surface->createdBufferSync);
WstLExpSyncClear(&surface->attachedBufferSync);
WstLExpSyncClear(&surface->detachedBufferSync);
if ( surface )
{
WstLExpSyncClear(&surface->createdBufferSync);
WstLExpSyncClear(&surface->attachedBufferSync);
WstLExpSyncClear(&surface->detachedBufferSync);
Comment thread
trupthi1403 marked this conversation as resolved.
}
Comment thread
trupthi1403 marked this conversation as resolved.
#endif
}

Expand Down Expand Up @@ -10191,6 +10194,7 @@ static void wstPruneOrphanFiles( WstContext *ctx )
int prefixLen;
int pid, rc;
char work[34];
char filepath[64];
if ( NULL != (dir = opendir( "/tmp" )) )
Comment thread
trupthi1403 marked this conversation as resolved.
{
prefixLen= strlen(TEMPFILE_PREFIX);
Expand All @@ -10202,15 +10206,38 @@ static void wstPruneOrphanFiles( WstContext *ctx )
snprintf( work, sizeof(work), "%s/%s", "/tmp", result->d_name);
if ( sscanf( work, TEMPFILE_TEMPLATE, &pid ) == 1 )
{
Comment thread
trupthi1403 marked this conversation as resolved.
// Check if the pid of this temp file is still valid
snprintf(work, sizeof(work), "/proc/%d", pid);
rc= stat( work, &fileinfo );
if ( rc )
{
// The pid is not valid, delete the file
snprintf( work, sizeof(work), "%s/%s", "/tmp", result->d_name);
INFO("removing temp file: %s", work);
remove( work );
int fd;
Comment thread
trupthi1403 marked this conversation as resolved.
Comment thread
trupthi1403 marked this conversation as resolved.
snprintf( filepath, sizeof(filepath), "%s/%s", "/tmp", result->d_name);

fd = open( filepath, O_RDONLY | O_NOFOLLOW | O_CLOEXEC );
if ( fd >= 0 )
{
if ( fstat( fd, &fileinfo ) == 0 )
{
if ( S_ISREG(fileinfo.st_mode) )
{
INFO("removing temp file: %s", filepath);
if ( unlink( filepath ) != 0 )
{
Comment thread
trupthi1403 marked this conversation as resolved.
WARNING("Failed to remove temp file: %s (errno: %d)", filepath, errno);
}
Comment thread
trupthi1403 marked this conversation as resolved.
close( fd );
Comment thread
trupthi1403 marked this conversation as resolved.
}
else
{
close( fd );
WARNING("Skipping non-regular file: %s (mode: 0%o)", filepath, fileinfo.st_mode);
}
}
else
{
close( fd );
}
Comment thread
trupthi1403 marked this conversation as resolved.
}
}
}
}
Expand Down
Loading