Xserver-gimp: better algorithm for finding stale Xserver sockets

This commit is contained in:
Sergii Pylypenko
2013-11-13 22:33:01 +02:00
parent 2f241f8cb4
commit 2fb6a5bd95
2 changed files with 21 additions and 2 deletions

View File

@@ -175,10 +175,10 @@ MultiABI=armeabi-v7a
AppMinimumRAM=0
# Application version code (integer)
AppVersionCode=28203
AppVersionCode=28204
# Application user-visible version name (string)
AppVersionName="2.8.2.03"
AppVersionName="2.8.2.04"
# Reset SDL config when updating application to the new version (y) / (n)
ResetSdlConfigForThisVersion=y

View File

@@ -95,6 +95,25 @@ int main( int argc, char* argv[] )
close(s);
}
*/
FILE * ff = fopen("/proc/net/unix", "rb");
if( ff )
{
char buf[512], name[512];
int found = 0;
sprintf(name, "/tmp/.X11-unix/X%d", i);
while( fgets(buf, sizeof(buf), ff) )
{
if( strstr(buf, name) != NULL )
{
__android_log_print(ANDROID_LOG_INFO, "XSDL", "UNIX path %s already used, trying next one", name);
found = 1;
break;
}
}
fclose(ff);
if( found )
continue;
}
sprintf( port, ":%d", i );
break;