Skip to content

Commit

Permalink
[tools] common/util.h: Make INFO and DBG print to stderr
Browse files Browse the repository at this point in the history
Printing to stdout causes INFO and DBG messages to be mixed with the
standard output of the tool that relies on attestation (the verifier).

Fixes: bc0d87a ("[SGX] Add standalone SGX utilities")
Signed-off-by: Wojtek Porczyk <[email protected]>
  • Loading branch information
woju authored and dimakuv committed Oct 31, 2023
1 parent f066fab commit 94fcedf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions libos/test/fs/test_enc.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ def test_000_gen_key(self):
# test random key generation
key_path = os.path.join(self.TEST_DIR, 'tmpkey')
args = ['gen-key', '-w', key_path]
stdout, _ = self.__pf_crypt(args)
self.assertIn('Wrap key saved to: ' + key_path, stdout)
_, stderr = self.__pf_crypt(args)
self.assertIn('Wrap key saved to: ' + key_path, stderr)
self.assertEqual(os.path.getsize(key_path), 16)
os.remove(key_path)

Expand Down
4 changes: 2 additions & 2 deletions tools/sgx/common/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ extern endianness_t g_endianness;
#define DBG(fmt, ...) \
do { \
if (g_verbose) \
dprintf(g_stdout_fd, fmt, ##__VA_ARGS__); \
dprintf(g_stderr_fd, fmt, ##__VA_ARGS__); \
} while (0)

#define INFO(fmt, ...) \
do { \
dprintf(g_stdout_fd, fmt, ##__VA_ARGS__); \
dprintf(g_stderr_fd, fmt, ##__VA_ARGS__); \
} while (0)

#define ERROR(fmt, ...) \
Expand Down

0 comments on commit 94fcedf

Please sign in to comment.