author | Olivier Brunel
<jjk@jjacky.com> 2015-04-21 19:18:49 UTC |
committer | Olivier Brunel
<jjk@jjacky.com> 2015-04-21 19:18:49 UTC |
parent | b2e170f82eb94e77eb454b001e0222ddefcf30df |
src/libanopa/service_status.c | +6 | -0 |
diff --git a/src/libanopa/service_status.c b/src/libanopa/service_status.c index b86aa97..676f047 100644 --- a/src/libanopa/service_status.c +++ b/src/libanopa/service_status.c @@ -20,6 +20,7 @@ * anopa. If not, see http://www.gnu.org/licenses/ */ +#include <errno.h> #include <sys/types.h> #include <sys/stat.h> #include <skalibs/allreadwrite.h> @@ -49,7 +50,9 @@ aa_service_status_read (aa_service_status *svst, const char *dir) if (!openreadfileclose (file, &svst->sa, AA_SVST_FIXED_SIZE + AA_SVST_MAX_MSG_SIZE + 1) || svst->sa.len < AA_SVST_FIXED_SIZE) { + int e = errno; tain_now_g (); + errno = e; return -1; } tain_now_g (); @@ -74,6 +77,7 @@ aa_service_status_write (aa_service_status *svst, const char *dir) char file[len + 1 + sizeof (AA_SVST_FILENAME)]; mode_t mask; int r; + int e; if (!stralloc_ready_tuned (&svst->sa, AA_SVST_FIXED_SIZE, 0, 0, 1)) return -1; @@ -93,9 +97,11 @@ aa_service_status_write (aa_service_status *svst, const char *dir) r = -1; else r = 0; + e = errno; umask (mask); tain_now_g (); + errno = e; return r; }