summaryrefslogtreecommitdiff
path: root/src/corelib/x11
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graeme@mastermaths.co.za>2009-12-21 11:17:13 +0200
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2009-12-21 11:17:13 +0200
commit065ede0ae7c13641ac5d9bccf088a8273163f5e3 (patch)
treee7217b56eef8b9adac57c7786e9b628e291384cb /src/corelib/x11
parentb956076431dc82d83d73de24ee5436c5c9a8f4a2 (diff)
downloadfpGUI-065ede0ae7c13641ac5d9bccf088a8273163f5e3.tar.xz
Fix User/Group Name lookups on *unix file-systems.
Removable media might have group or user ID's not available on the new host system. Name lookups will then fail. This patch works around that issue.
Diffstat (limited to 'src/corelib/x11')
-rw-r--r--src/corelib/x11/fpg_x11.pas17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/corelib/x11/fpg_x11.pas b/src/corelib/x11/fpg_x11.pas
index 09305c1e..036b0408 100644
--- a/src/corelib/x11/fpg_x11.pas
+++ b/src/corelib/x11/fpg_x11.pas
@@ -2388,10 +2388,19 @@ begin
Result.IsExecutable := ((sr.Mode and $40) <> 0);
Result.mode := EncodeModeString(sr.Mode);
Fpstat(PChar(fullname), info);
- {Result.GroupID := info.st_gid;
- Result.OwnerID := info.st_uid;}
- Result.Owner := GetUserName(TUID(info.st_uid));
- Result.Group := GetGroupName(TGID(info.st_uid));
+ // Especially if files are transfered on removable media the host system
+ // might not have those user or group ids. So name lookups will fail. This
+ // simply returns the ID's in such cases.
+ try
+ Result.Owner := GetUserName(TUID(info.st_uid));
+ except
+ Result.Owner := IntToStr(info.st_uid);
+ end;
+ try
+ Result.Group := GetGroupName(TGID(info.st_gid));
+ except
+ Result.Group := IntToStr(info.st_gid);
+ end;
end;
end;