Denys Vlasenko <[email protected]> writes:

> On 03/19/2012 05:52 PM, Richard Marko wrote:
>> [PATCH] Save cgroup information for crashing process
>>
>> Stored in /proc/<pid>/cgroup
>> ---
>>   src/hooks/abrt-hook-ccpp.c |    5 +++++
>>   1 files changed, 5 insertions(+), 0 deletions(-)
>>
>> diff --git a/src/hooks/abrt-hook-ccpp.c b/src/hooks/abrt-hook-ccpp.c
>> index 83dbf9f..1a918c8 100644
>> --- a/src/hooks/abrt-hook-ccpp.c
>> +++ b/src/hooks/abrt-hook-ccpp.c
>> @@ -713,6 +713,11 @@ int main(int argc, char** argv)
>>           copy_file(source_filename, dest_filename, 0640);
>>           IGNORE_RESULT(chown(dest_filename, dd->dd_uid, dd->dd_gid));
>>
>> +        strcpy(source_filename + source_base_ofs, "cgroup");
>> +        strcpy(dest_base, FILENAME_CGROUP);
>> +        copy_file(source_filename, dest_filename, 0640);
>
> I think cgroups support in kernel is optional,
> so /proc/PID/cgroup may be not there.
>
> This will emit error messages if source file does not exist.
> I guess you need to either suppress error messages
> or check existence of source file before copy_file() call.

for fedora and rhel7 it's mandatory due to systemd. Nevertheless
checking should be there.

-- 
Nikola

Reply via email to