fixed segfault with monitor detection
git-svn-id: http://tint2.googlecode.com/svn/trunk@469 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
@@ -155,9 +155,7 @@ int get_task_status(char* status)
|
||||
|
||||
int config_get_monitor(char* monitor)
|
||||
{
|
||||
if (strcmp(monitor, "all") == 0)
|
||||
return -1;
|
||||
else {
|
||||
if (strcmp(monitor, "all") != 0) {
|
||||
char* endptr;
|
||||
int ret_int = strtol(monitor, &endptr, 10);
|
||||
if (*endptr == 0)
|
||||
@@ -166,6 +164,9 @@ int config_get_monitor(char* monitor)
|
||||
// monitor specified by name, not by index
|
||||
int i, j;
|
||||
for (i=0; i<server.nb_monitor; ++i) {
|
||||
if (server.monitor[i].names == 0)
|
||||
// xrandr can't identify monitors
|
||||
continue;
|
||||
j = 0;
|
||||
while (server.monitor[i].names[j] != 0) {
|
||||
if (strcmp(monitor, server.monitor[i].names[j++]) == 0)
|
||||
@@ -174,6 +175,7 @@ int config_get_monitor(char* monitor)
|
||||
}
|
||||
}
|
||||
}
|
||||
// monitor == "all" or monitor not found or xrandr can't identify monitors
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user