~ubuntu-branches/ubuntu/utopic/tig/utopic

« back to all changes in this revision

Viewing changes to debian/patches/bts594549-pager-segfault.dpatch

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Harl
  • Date: 2010-09-03 21:23:44 UTC
  • Revision ID: james.westby@ubuntu.com-20100903212344-rpdhaez0gtp2f1l9
Tags: 0.16-2
* debian/patches:
  - Added bts594549-pager-segfault - upstream patch fixing a segfault when
    started in pager mode; thanks to Kumar Appaiah for reporting this and
    pointing out the upstream fix (Closes: #594549).
* debian/control, debian/rules:
  - Build-depend on and use dpatch.
* Added debian/README.source:
  - The file includes a pointer to /usr/share/doc/dpatch/README.source.gz.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh /usr/share/dpatch/dpatch-run
 
2
## bts594549-pager-segfault.dpatch by Jonas Fonseca <fonseca@diku.dk>
 
3
##
 
4
## DP: Fix segfault when starting tig in pager mode.
 
5
## DP:
 
6
## DP: (Upstream commit 5355b6ed446a22714d944c316f3c037348f67d76)
 
7
 
 
8
@DPATCH@
 
9
 
 
10
diff a/tig.c b/tig.c
 
11
--- a/tig.c
 
12
+++ b/tig.c
 
13
@@ -2308,7 +2308,7 @@
 
14
        VIEW_(BLAME,  "blame",  &blame_ops,  TRUE,  ref_commit),
 
15
        VIEW_(BRANCH, "branch", &branch_ops, TRUE,  ref_head),
 
16
        VIEW_(HELP,   "help",   &help_ops,   FALSE, ""),
 
17
-       VIEW_(PAGER,  "pager",  &pager_ops,  FALSE, "stdin"),
 
18
+       VIEW_(PAGER,  "pager",  &pager_ops,  FALSE, ""),
 
19
        VIEW_(STATUS, "status", &status_ops, TRUE,  ""),
 
20
        VIEW_(STAGE,  "stage",  &stage_ops,  TRUE,  ""),
 
21
 };
 
22
@@ -3700,6 +3700,13 @@
 
23
                break;
 
24
 
 
25
        case REQ_VIEW_PAGER:
 
26
+               if (view == NULL) {
 
27
+                       if (!io_open(&VIEW(REQ_VIEW_PAGER)->io, ""))
 
28
+                               die("Failed to open stdin");
 
29
+                       open_view(view, request, OPEN_PREPARED);
 
30
+                       break;
 
31
+               }
 
32
+
 
33
                if (!VIEW(REQ_VIEW_PAGER)->pipe && !VIEW(REQ_VIEW_PAGER)->lines) {
 
34
                        report("No pager content, press %s to run command from prompt",
 
35
                               get_key(view->keymap, REQ_PROMPT));
 
36
@@ -7729,10 +7736,8 @@
 
37
        const char **filter_argv = NULL;
 
38
        int i;
 
39
 
 
40
-       if (!isatty(STDIN_FILENO)) {
 
41
-               io_open(&VIEW(REQ_VIEW_PAGER)->io, "");
 
42
+       if (!isatty(STDIN_FILENO))
 
43
                return REQ_VIEW_PAGER;
 
44
-       }
 
45
 
 
46
        if (argc <= 1)
 
47
                return REQ_VIEW_MAIN;