diff options
-rw-r--r-- | sway/config.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sway/config.c b/sway/config.c index f99f043c..ea9f23dd 100644 --- a/sway/config.c +++ b/sway/config.c | |||
@@ -597,6 +597,7 @@ static ssize_t getline_with_cont(char **lineptr, size_t *line_size, FILE *file) | |||
597 | } | 597 | } |
598 | 598 | ||
599 | static int detect_brace(FILE *file) { | 599 | static int detect_brace(FILE *file) { |
600 | int ret = 0; | ||
600 | int lines = 0; | 601 | int lines = 0; |
601 | long pos = ftell(file); | 602 | long pos = ftell(file); |
602 | char *line = NULL; | 603 | char *line = NULL; |
@@ -605,15 +606,15 @@ static int detect_brace(FILE *file) { | |||
605 | lines++; | 606 | lines++; |
606 | strip_whitespace(line); | 607 | strip_whitespace(line); |
607 | if (*line) { | 608 | if (*line) { |
608 | if (strcmp(line, "{") != 0) { | 609 | if (strcmp(line, "{") == 0) { |
609 | fseek(file, pos, SEEK_SET); | 610 | ret = lines; |
610 | lines = 0; | ||
611 | } | 611 | } |
612 | break; | 612 | break; |
613 | } | 613 | } |
614 | } | 614 | } |
615 | free(line); | 615 | free(line); |
616 | return lines; | 616 | fseek(file, pos, SEEK_SET); |
617 | return ret; | ||
617 | } | 618 | } |
618 | 619 | ||
619 | static char *expand_line(const char *block, const char *line, bool add_brace) { | 620 | static char *expand_line(const char *block, const char *line, bool add_brace) { |