]> git.tdb.fi Git - libs/core.git/blob - source/fs/android/stat_owner.cpp
Add a NonCopyable utility base class
[libs/core.git] / source / fs / android / stat_owner.cpp
1 #include <grp.h>
2 #include <pwd.h>
3 #include <msp/strings/format.h>
4 #include "stat.h"
5 #include "stat_private.h"
6
7 namespace Msp {
8 namespace FS {
9
10 void Stat::Private::fill_owner_info(Stat::OwnerInfo &result)
11 {
12         struct passwd *owner;
13         if((owner = getpwuid(owner_id)))
14                 result.owner = owner->pw_name;
15         else
16                 result.owner = format("%d", owner_id);
17
18         struct group *group;
19         if((group = getgrgid(group_id)))
20                 result.group = group->gr_name;
21         else
22                 result.group = format("%d", group_id);
23 }
24
25 } // namespace FS
26 } // namespace Msp