Skip to content

Commit 10a8215

Browse files
committed
Correctly read command from config and fix test case
1 parent 8c860ce commit 10a8215

File tree

8 files changed

+17
-8
lines changed

8 files changed

+17
-8
lines changed

src/seat-xvnc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ seat_xvnc_create_display_server (Seat *seat)
4141
xserver = xserver_xvnc_new ();
4242
xserver_xvnc_set_socket (xserver, g_socket_get_fd (SEAT_XVNC (seat)->priv->connection));
4343

44-
command = config_get_string (config_get_instance (), "VNCServer", "xserver-command");
44+
command = config_get_string (config_get_instance (), "VNCServer", "command");
4545
if (command)
4646
xserver_xvnc_set_command (xserver, command);
4747

tests/Makefile.am

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ TESTS = \
128128
test-switch-to-user-no-password \
129129
test-switch-to-user-logout \
130130
test-vnc-login \
131+
test-vnc-command \
132+
test-vnc-open-file-descriptors \
131133
test-xdmcp-login \
132134
test-no-accounts-service \
133135
test-console-kit \
@@ -313,7 +315,9 @@ EXTRA_DIST = \
313315
scripts/util-path.conf \
314316
scripts/user-renamed.conf \
315317
scripts/user-renamed-invalid.conf \
318+
scripts/vnc-command.conf \
316319
scripts/vnc-login.conf \
320+
scripts/vnc-open-file-descriptors.conf \
317321
scripts/xauthority.conf \
318322
scripts/xdmcp-login.conf \
319323
scripts/xdmcp-open-file-descriptors.conf \

tests/scripts/vnc-command.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ start-default-seat=false
99
[VNCServer]
1010
enabled=true
1111
port=9999
12-
command=Xvnc -depth 16
12+
command=Xvnc -option
1313

1414
#?RUNNER DAEMON-START
1515
#?*WAIT 1
@@ -20,7 +20,7 @@ command=Xvnc -depth 16
2020
#?VNC-CLIENT CONNECT SERVER=::9999
2121

2222
# Xvnc server starts
23-
#?XSERVER :50 START GEOMETRY=1024x768 DEPTH=16
23+
#?XSERVER :50 START GEOMETRY=1024x768 DEPTH=8 OPTION=TRUE
2424

2525
# Clean up
2626
#?*STOP-DAEMON

tests/scripts/vnc-login.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ port=9999
1919
#?VNC-CLIENT CONNECT SERVER=::9999
2020

2121
# Xvnc server starts
22-
#?XSERVER :50 START GEOMETRY=1024x768 DEPTH=8
22+
#?XSERVER :50 START GEOMETRY=1024x768 DEPTH=8 OPTION=FALSE
2323

2424
# Negotiate with Xvnc
2525
#?VNC-CLIENT CONNECTED VERSION="RFB 003.007"

tests/scripts/vnc-open-file-descriptors.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ port=9999
1919
#?VNC-CLIENT CONNECT SERVER=::9999
2020

2121
# Xvnc server starts
22-
#?XSERVER :50 START GEOMETRY=1024x768 DEPTH=8
22+
#?XSERVER :50 START GEOMETRY=1024x768 DEPTH=8 OPTION=FALSE
2323

2424
# Negotiate with Xvnc
2525
#?VNC-CLIENT CONNECTED VERSION="RFB 003.007"

tests/src/Xvnc.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ main (int argc, char **argv)
174174
gboolean listen_tcp = TRUE;
175175
gboolean listen_unix = TRUE;
176176
gboolean use_inetd = FALSE;
177+
gboolean has_option = FALSE;
177178
gchar *geometry = g_strdup ("640x480");
178179
gint depth = 8;
179180
int lock_file;
@@ -228,6 +229,10 @@ main (int argc, char **argv)
228229
{
229230
use_inetd = TRUE;
230231
}
232+
else if (strcmp (arg, "-option") == 0)
233+
{
234+
has_option = TRUE;
235+
}
231236
else
232237
{
233238
g_printerr ("Unrecognized option: %s\n"
@@ -248,7 +253,7 @@ main (int argc, char **argv)
248253
x_server_set_listen_unix (xserver, listen_unix);
249254
x_server_set_listen_tcp (xserver, listen_tcp);
250255

251-
status_notify ("XSERVER :%d START GEOMETRY=%s DEPTH=%d", display_number, geometry, depth);
256+
status_notify ("XSERVER :%d START GEOMETRY=%s DEPTH=%d OPTION=%s", display_number, geometry, depth, has_option ? "TRUE" : "FALSE");
252257

253258
config = g_key_file_new ();
254259
g_key_file_load_from_file (config, g_build_filename (g_getenv ("LIGHTDM_TEST_ROOT"), "script", NULL), G_KEY_FILE_NONE, NULL);

tests/src/vnc-client.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ main (int argc, char **argv)
8181
if (error)
8282
g_warning ("Unable to receive on VNC socket: %s", error->message);
8383
g_clear_error (&error);
84-
if (n_read < 0)
84+
if (n_read <= 0)
8585
return EXIT_FAILURE;
8686

8787
buffer[n_read] = '\0';

tests/test-vnc-command

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#!/bin/sh
2-
./src/dbus-env ./src/test-runner vnc-login test-gobject-greeter
2+
./src/dbus-env ./src/test-runner vnc-command test-gobject-greeter

0 commit comments

Comments
 (0)