This probably only seems worthwhile to those of us who spend a large
part of every day staring at strace output, but in case you're
interested...

Before (on a device with only one RTC):

getdents64(3, /* 3 entries */, 4200)    = 72
newfstatat(3, ".", {st_mode=S_IFDIR|0755, st_size=0, ...},
AT_SYMLINK_NOFOLLOW) = 0
openat(AT_FDCWD, "/sys/class/rtc/./hctosys", O_RDONLY) = -1 ENOENT (No
such file or directory)
newfstatat(3, "..", {st_mode=S_IFDIR|0755, st_size=0, ...},
AT_SYMLINK_NOFOLLOW) = 0
openat(AT_FDCWD, "/sys/class/rtc/../hctosys", O_RDONLY) = -1 ENOENT
(No such file or directory)
newfstatat(3, "rtc0", {st_mode=S_IFLNK|0777, st_size=0, ...},
AT_SYMLINK_NOFOLLOW) = 0
...

After:
getdents64(3, /* 3 entries */, 4200)    = 72
newfstatat(3, ".", {st_mode=S_IFDIR|0755, st_size=0, ...},
AT_SYMLINK_NOFOLLOW) = 0
newfstatat(3, "..", {st_mode=S_IFDIR|0755, st_size=0, ...},
AT_SYMLINK_NOFOLLOW) = 0
newfstatat(3, "rtc0", {st_mode=S_IFLNK|0777, st_size=0, ...},
AT_SYMLINK_NOFOLLOW) = 0
...

diff --git a/toys/pending/hwclock.c b/toys/pending/hwclock.c
index 003174f..04f4770 100644
--- a/toys/pending/hwclock.c
+++ b/toys/pending/hwclock.c
@@ -35,6 +35,7 @@ static int check_hctosys(struct dirtree* node)
   FILE *fp;

   if (!node->parent) return DIRTREE_RECURSE;
+  if (!dirtree_notdotdot(node)) return 0;

   snprintf(toybuf, sizeof(toybuf), "/sys/class/rtc/%s/hctosys", node->name);
   fp = fopen(toybuf, "r");
_______________________________________________
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to