| … | |
… | |
| 112 | int print_sandbox_log(char *sandbox_log) |
112 | int print_sandbox_log(char *sandbox_log) |
| 113 | { |
113 | { |
| 114 | int sandbox_log_file = -1; |
114 | int sandbox_log_file = -1; |
| 115 | char *beep_count_env = NULL; |
115 | char *beep_count_env = NULL; |
| 116 | int i, color, beep_count = 0; |
116 | int i, color, beep_count = 0; |
| 117 | long len = 0; |
117 | off_t len = 0; |
| 118 | char *buffer = NULL; |
118 | char *buffer = NULL; |
| 119 | |
119 | |
| 120 | if (!rc_is_file(sandbox_log, FALSE)) { |
120 | if (!rc_is_file(sandbox_log, FALSE)) { |
| 121 | perror("sandbox: Log file is not a regular file"); |
121 | perror("sandbox: Log file is not a regular file"); |
| 122 | return 0; |
122 | return 0; |
| … | |
… | |
| 126 | if (-1 == sandbox_log_file) { |
126 | if (-1 == sandbox_log_file) { |
| 127 | perror("sandbox: Could not open Log file"); |
127 | perror("sandbox: Could not open Log file"); |
| 128 | return 0; |
128 | return 0; |
| 129 | } |
129 | } |
| 130 | |
130 | |
| 131 | len = file_length(sandbox_log_file); |
131 | len = rc_get_size(sandbox_log, TRUE); |
| 132 | buffer = (char *)xmalloc((len + 1) * sizeof(char)); |
132 | buffer = (char *)xmalloc((len + 1) * sizeof(char)); |
| 133 | memset(buffer, 0, len + 1); |
133 | memset(buffer, 0, len + 1); |
| 134 | read(sandbox_log_file, buffer, len); |
134 | read(sandbox_log_file, buffer, len); |
| 135 | close(sandbox_log_file); |
135 | close(sandbox_log_file); |
| 136 | |
136 | |