]> git.pld-linux.org Git - packages/suspend-utils.git/blob - s2disk-do-not-fail-without-local-terminals.patch
- disable encryption with bcond and warning banner
[packages/suspend-utils.git] / s2disk-do-not-fail-without-local-terminals.patch
1 ---
2  suspend.c |   38 ++++++++++++++++++++++++++------------
3  1 file changed, 26 insertions(+), 12 deletions(-)
4
5 Index: suspend-utils-1.0/suspend.c
6 ===================================================================
7 --- suspend-utils-1.0.orig/suspend.c
8 +++ suspend-utils-1.0/suspend.c
9 @@ -57,6 +57,15 @@ do { \
10         fprintf(stderr, "%s: " msg " Reason: %m\n", my_name, ## args); \
11  } while (0)
12  
13 +#ifndef CONFIG_ARCH_S390
14 +#define suspend_warning(msg) \
15 +do { \
16 +       fprintf(stderr, "%s: " msg "\n", my_name); \
17 +} while (0)
18 +#else
19 +#define suspend_warning(msg)
20 +#endif
21 +
22  static char snapshot_dev_name[MAX_STR_LEN] = SNAPSHOT_DEVICE;
23  static char resume_dev_name[MAX_STR_LEN] = RESUME_DEVICE;
24  static loff_t resume_offset;
25 @@ -2489,21 +2498,24 @@ int main(int argc, char *argv[])
26  
27         vt_fd = prepare_console(&orig_vc, &suspend_vc);
28         if (vt_fd < 0) {
29 -               ret = errno;
30 -               if (vt_fd == -ENOTTY)
31 -                       suspend_error("No local tty. Remember to specify local " \
32 -                                       "console after the remote.");
33 -               else
34 +               if (vt_fd == -ENOTTY) {
35 +                       suspend_warning("Unable to switch virtual terminals, "
36 +                                       "using the current console.");
37 +               } else {
38                         suspend_error("Could not open a virtual terminal.");
39 -               goto Close_snapshot_fd;
40 +                       ret = errno;
41 +                       goto Close_snapshot_fd;
42 +               }
43         }
44  
45         splash_prepare(&splash, splash_param);
46  
47 -       if (lock_vt() < 0) {
48 -               ret = errno;
49 -               suspend_error("Could not lock the terminal.");
50 -               goto Restore_console;
51 +       if (vt_fd >= 0) {
52 +               if (lock_vt() < 0) {
53 +                       ret = errno;
54 +                       suspend_error("Could not lock the terminal.");
55 +                       goto Restore_console;
56 +               }
57         }
58  
59         splash.progress(5);
60 @@ -2547,10 +2559,12 @@ int main(int argc, char *argv[])
61                 set_swappiness(orig_swappiness);
62         close_swappiness();
63  
64 -       unlock_vt();
65 +       if (vt_fd >= 0)
66 +               unlock_vt();
67  Restore_console:
68         splash.finish();
69 -       restore_console(vt_fd, orig_vc);
70 +       if (vt_fd >= 0)
71 +               restore_console(vt_fd, orig_vc);
72  Close_snapshot_fd:
73         close(snapshot_fd);
74  Close_resume_fd:
This page took 0.495506 seconds and 3 git commands to generate.