[systemd-devel] [PATCH 2/2] Run with a custom SMACK domain (label).

Kok, Auke-jan H auke-jan.h.kok at intel.com
Wed Oct 2 09:55:36 PDT 2013


On Tue, Oct 1, 2013 at 4:42 PM, Lennart Poettering
<lennart at poettering.net> wrote:
> On Tue, 01.10.13 16:11, Auke Kok (auke-jan.h.kok at intel.com) wrote:
>
>> index 1434dea..d7b8dce 100644
>> --- a/src/core/smack-setup.c
>> +++ b/src/core/smack-setup.c
>> @@ -36,6 +36,7 @@
>>  #include "macro.h"
>>  #include "smack-setup.h"
>>  #include "util.h"
>> +#include "fileio.h"
>>  #include "log.h"
>>  #include "label.h"
>>
>> @@ -138,6 +139,12 @@ int smack_setup(void) {
>>                  return 0;
>>          }
>>
>> +#ifdef SMACK_RUN_LABEL
>> +        if (write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL))
>> +                log_warning("Failed to set SMACK label \"%s\" on self: %s",
>> +                            SMACK_RUN_LABEL, strerror(abs(r)));
>> +#endif
>
> Looks got in principle, but error handling is borked. You need to assign
> r first before you print it. Also, write_string_file returns negative
> errno, so you should just strerror(-r) instead of strerror(abs(r)).

derp prize. Apologies. Will fix.

Auke


More information about the systemd-devel mailing list