From 2696387f07c9677f531760f6dac18b0f451efc74 Mon Sep 17 00:00:00 2001 From: Hyotaek Shim Date: Fri, 29 Nov 2019 01:48:58 +0000 Subject: [PATCH] Revert "libdlog doesn't modify errno from outside PoV" This reverts commit 6afdbf69c184f8b1b466af16d65272ad9e7f757a. Change-Id: Ie046f84788b84f748211df374d8d601db1280810 (cherry picked from commit c1bfe2b28c85594c5180c83f2fed0c1e9b116570) --- src/libdlog/log.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/libdlog/log.c b/src/libdlog/log.c index 06b4207..755429e 100644 --- a/src/libdlog/log.c +++ b/src/libdlog/log.c @@ -310,19 +310,6 @@ static int __write_to_log(log_id_t log_id, int prio, const char *tag, const char if (ret < 0) return ret; - /* DLog is often used to log errors, but people usually fail to - * handle errno correctly, forgetting that logging can also - * modify it, like this: - * - * if (foo() == -1) { - * dlog_print(...); - * if (errno == ...) // potentially uses DLog's errno - * - * Therefore we take an extra step to remedy this. It is fairly - * unfortunate to have to do this because it might encourage lazy - * coding, but it's probably more important that the system works. */ - const int initial_errno = errno; - /* Threads can be cancelled before they give up a lock. * Therefore cancellation is temporarily disabled. * This solution is comparatively simple and cheap. @@ -347,7 +334,6 @@ static int __write_to_log(log_id_t log_id, int prio, const char *tag, const char pthread_setcancelstate(old_cancel_state, NULL); - errno = initial_errno; return ret; } -- 2.7.4