mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-20 10:13:17 +00:00
Updated, so if XOpenDisplay() fails, an error is propagated back up
This commit is contained in:
@@ -87,6 +87,19 @@ typedef struct x11_struct
|
|||||||
}x11_struct;
|
}x11_struct;
|
||||||
x11_struct *x11_exports = NULL;
|
x11_struct *x11_exports = NULL;
|
||||||
|
|
||||||
|
void kvm_send_error(char *msg)
|
||||||
|
{
|
||||||
|
int msgLen = strnlen_s(msg, 255);
|
||||||
|
char buffer[512];
|
||||||
|
|
||||||
|
((unsigned short*)buffer)[0] = (unsigned short)htons((unsigned short)MNG_ERROR); // Write the type
|
||||||
|
((unsigned short*)buffer)[1] = (unsigned short)htons((unsigned short)(msgLen + 4)); // Write the size
|
||||||
|
memcpy_s(buffer + 4, 512 - 4, msg, msgLen);
|
||||||
|
|
||||||
|
if (write(slave2master[1], buffer, msgLen + 4)) {}
|
||||||
|
fsync(slave2master[1]);
|
||||||
|
}
|
||||||
|
|
||||||
void kvm_send_resolution()
|
void kvm_send_resolution()
|
||||||
{
|
{
|
||||||
char buffer[8];
|
char buffer[8];
|
||||||
@@ -341,6 +354,7 @@ int kvm_init(int displayNo)
|
|||||||
//fprintf(logFile, "DisplayString=%s\n", displayString);
|
//fprintf(logFile, "DisplayString=%s\n", displayString);
|
||||||
//fprintf(logFile, "XAUTHORITY is %s", getenv("XAUTHORITY")); fflush(logFile);
|
//fprintf(logFile, "XAUTHORITY is %s", getenv("XAUTHORITY")); fflush(logFile);
|
||||||
//fprintf(logFile, "Error calling XOpenDisplay()\n"); fflush(logFile);
|
//fprintf(logFile, "Error calling XOpenDisplay()\n"); fflush(logFile);
|
||||||
|
kvm_send_error("Error occured calling XOpenDisplay()");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eventdisplay != NULL) { current_display = (unsigned short)displayNo; }
|
if (eventdisplay != NULL) { current_display = (unsigned short)displayNo; }
|
||||||
|
|||||||
Reference in New Issue
Block a user