Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/lstat.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,20 @@
#include "lstat.h"


wrapper(lstat, int, (int ver, const char * filename, struct stat * buf))
wrapper(lstat, int, (const char * filename, struct stat * buf))
{
debug("lstat(%d, \"%s\", &buf)", ver, filename);
char abs_filename[FAKECHROOT_PATH_MAX];

debug("lstat(\"%s\", &buf)", filename);

if (!fakechroot_localdir(filename)) {
if (filename != NULL) {
char abs_filename[FAKECHROOT_PATH_MAX];
rel2abs(filename, abs_filename);
filename = abs_filename;
}
}

return lstat_rel(ver, filename, buf);
return lstat_rel(filename, buf);
}


Expand Down
2 changes: 1 addition & 1 deletion src/lstat.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

#ifndef HAVE___LXSTAT

wrapper_proto(lstat, int, (int, const char *, struct stat *));
wrapper_proto(lstat, int, (const char *, struct stat *));

int lstat_rel(const char *, struct stat *);

Expand Down
2 changes: 2 additions & 0 deletions src/stat.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@

wrapper(stat, int, (const char * file_name, struct stat * buf))
{
char fakechroot_abspath[FAKECHROOT_PATH_MAX];
char fakechroot_buf[FAKECHROOT_PATH_MAX];
Comment on lines +36 to +37
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the point of adding two statically allocated string variables and not using them at all?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind, I looked at the expand_chroot_path() macro and it uses these two for the expansion. A non-obvious approach, but I guess we work with what we've got :)

debug("stat(\"%s\", &buf)", file_name);
expand_chroot_path(file_name);
return nextcall(stat)(file_name, buf);
Expand Down
2 changes: 2 additions & 0 deletions src/stat64.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@

wrapper(stat64, int, (const char * file_name, struct stat64 * buf))
{
char fakechroot_abspath[FAKECHROOT_PATH_MAX];
char fakechroot_buf[FAKECHROOT_PATH_MAX];
debug("stat64(\"%s\", &buf)", file_name);
expand_chroot_path(file_name);
return nextcall(stat64)(file_name, buf);
Expand Down