diff options
author | Martin Schlemmer <azarah@gentoo.org> | 2006-07-11 16:27:38 +0000 |
---|---|---|
committer | Martin Schlemmer <azarah@gentoo.org> | 2006-07-11 16:27:38 +0000 |
commit | 0153e86d64e463b9b85c33cf1256717529fb5f6f (patch) | |
tree | c6fe44db5120b060d29873b239283826a066a14d /src | |
parent | Use IO related sb_*() functions, and improve error checking. (diff) | |
download | sandbox-0153e86d64e463b9b85c33cf1256717529fb5f6f.tar.gz sandbox-0153e86d64e463b9b85c33cf1256717529fb5f6f.tar.bz2 sandbox-0153e86d64e463b9b85c33cf1256717529fb5f6f.zip |
Check log size before we open it.
Signed-off-by: Martin Schlemmer <azarah@gentoo.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/sandbox.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/sandbox.c b/src/sandbox.c index 83decf6..b78809a 100644 --- a/src/sandbox.c +++ b/src/sandbox.c @@ -122,15 +122,16 @@ int print_sandbox_log(char *sandbox_log) return 0; } + len = rc_get_size(sandbox_log, TRUE); + if (0 == len) + return 0; + sandbox_log_file = sb_open(sandbox_log, O_RDONLY, 0); if (-1 == sandbox_log_file) { perror("sandbox: Could not open Log file"); return 0; } - len = rc_get_size(sandbox_log, TRUE); - if (0 == len) - return 0; buffer = (char *)xmalloc((len + 1) * sizeof(char)); if (NULL == buffer) { perror("sandbox: Could not allocate buffer for Log file"); |