erlang: Update from 20.3.2 to 20.3.4
[termux-packages] / packages / procps / z01_eaccess.patch
1 Ignore Permission denied in several places.
2
3 On some Androids many of proc files can't actually be opened. So ignore
4 when opening fails and go on.
5
6 diff '--exclude=config.log' -ur src-orig/proc/sysinfo.c src/proc/sysinfo.c
7 --- src-orig/proc/sysinfo.c 2017-08-26 23:22:50.704748922 +0200
8 +++ src/proc/sysinfo.c 2017-08-27 00:08:52.482479053 +0200
9 @@ -97,6 +97,10 @@
10 char *savelocale;
11 #endif
12
13 + if (uptime_fd == -1 && (uptime_fd = open(UPTIME_FILE, O_RDONLY)) == -1) {
14 + return 0;
15 + }
16 +
17 FILE_TO_BUF(UPTIME_FILE,uptime_fd);
18 #ifndef __ANDROID__
19 savelocale = strdup(setlocale(LC_NUMERIC, NULL));
20 @@ -130,6 +136,7 @@
21 /* /proc/stat can get very large on multi-CPU systems so we
22 can't use FILE_TO_BUF */
23 if (!(f = fopen(STAT_FILE, "r"))) {
24 + return 0;
25 fputs(BAD_OPEN_MESSAGE, stderr);
26 fflush(NULL);
27 _exit(102);
28 @@ -389,6 +401,10 @@
29 char *savelocale;
30 #endif
31
32 + if (loadavg_fd == -1 && (loadavg_fd = open(LOADAVG_FILE, O_RDONLY)) == -1) {
33 + return;
34 + }
35 +
36 FILE_TO_BUF(LOADAVG_FILE,loadavg_fd);
37 #ifndef __ANDROID__
38 savelocale = strdup(setlocale(LC_NUMERIC, NULL));
39 diff '--exclude=config.log' -ur src-orig/top/top.c src/top/top.c
40 --- src-orig/top/top.c 2017-08-26 23:22:50.708748956 +0200
41 +++ src/top/top.c 2017-08-27 00:13:34.416643298 +0200
42 @@ -2379,7 +2379,7 @@
43 (sorry Linux, but you'll have to close it for us) */
44 if (!fp) {
45 if (!(fp = fopen("/proc/stat", "r")))
46 - error_exit(fmtmk(N_fmt(FAIL_statopn_fmt), strerror(errno)));
47 + return NULL;
48 /* note: we allocate one more CPU_t via totSLOT than 'cpus' so that a
49 slot can hold tics representing the /proc/stat cpu summary */
50 cpus = alloc_c(totSLOT * sizeof(CPU_t));
51 @@ -3814,7 +3814,7 @@
52 tmptty.c_cc[VERASE] = *key_backspace;
53 #ifdef TERMIOS_ONLY
54 if (-1 == tcsetattr(STDIN_FILENO, TCSAFLUSH, &tmptty))
55 - error_exit(fmtmk(N_fmt(FAIL_tty_set_fmt), strerror(errno)));
56 + {}
57 tcgetattr(STDIN_FILENO, &Tty_tweaked);
58 #endif
59 // lastly, a nearly raw mode for unsolicited single keystrokes
60 @@ -3822,7 +3822,7 @@
61 tmptty.c_cc[VMIN] = 1;
62 tmptty.c_cc[VTIME] = 0;
63 if (-1 == tcsetattr(STDIN_FILENO, TCSAFLUSH, &tmptty))
64 - error_exit(fmtmk(N_fmt(FAIL_tty_set_fmt), strerror(errno)));
65 + {}
66 tcgetattr(STDIN_FILENO, &Tty_raw);
67
68 #ifndef OFF_STDIOLBF
69 @@ -5155,7 +5155,7 @@
70 #ifndef NUMA_DISABLE
71 if (!Numa_node_tot) goto numa_nope;
72
73 - if (CHKw(w, View_CPUNOD)) {
74 + if (smpcpu && CHKw(w, View_CPUNOD)) {
75 if (Numa_node_sel < 0) {
76 // display the 1st /proc/stat line, then the nodes (if room)
77 summary_hlp(&smpcpu[smp_num_cpus], N_txt(WORD_allcpus_txt));
78 @@ -5191,12 +5191,12 @@
79 } else
80 numa_nope:
81 #endif
82 - if (CHKw(w, View_CPUSUM)) {
83 + if (smpcpu && CHKw(w, View_CPUSUM)) {
84 // display just the 1st /proc/stat line
85 summary_hlp(&smpcpu[Cpu_faux_tot], N_txt(WORD_allcpus_txt));
86 Msg_row += 1;
87
88 - } else {
89 + } else if (smpcpu) {
90 // display each cpu's states separately, screen height permitting...
91 for (i = 0; i < Cpu_faux_tot; i++) {
92 snprintf(tmp, sizeof(tmp), N_fmt(WORD_eachcpu_fmt), smpcpu[i].id);