[Toybox] Patch mountpoint

Hyejin Kim hj8296 at gmail.com
Wed May 6 03:59:57 PDT 2015


Hi.
The patch has an error and I attach again.


diff --git a/toys/other/mountpoint.c b/toys/other/mountpoint.c
index 150865c..4dff978 100644
--- a/toys/other/mountpoint.c
+++ b/toys/other/mountpoint.c
@@ -33,7 +33,8 @@ void mountpoint_main(void)
   char *arg = *toys.optargs;
   int quiet = toys.optflags & FLAG_q;

-  if (lstat(arg, &st1)) perror_exit("%s", arg);
+  if (((toys.optflags & FLAG_x) ? stat:lstat)(arg, &st1))
+    perror_exit("%s", arg);

   if (toys.optflags & FLAG_x) {
     if (S_ISBLK(st1.st_mode)) {
-- 




2015-05-06 17:34 GMT+09:00 Hyejin Kim <hj8296 at gmail.com>:

> Hi.
>
> Mountpoint doesnt support symlink argument now.
> For example, "mountpoint -x symlink_path" displays wrong output.
>
> plz have a look.
>
>
>
> diff --git a/toys/other/mountpoint.c b/toys/other/mountpoint.c
> index 150865c..d7432c9 100644
> --- a/toys/other/mountpoint.c
> +++ b/toys/other/mountpoint.c
> @@ -33,7 +33,8 @@ void mountpoint_main(void)
>    char *arg = *toys.optargs;
>    int quiet = toys.optflags & FLAG_q;
>
> -  if (lstat(arg, &st1)) perror_exit("%s", arg);
> +  if ((toys.optflags & FLAG_x) && stat(arg, &st1) || lstat(arg, &st1))
> +    perror_exit("%s", arg);
>
>    if (toys.optflags & FLAG_x) {
>      if (S_ISBLK(st1.st_mode)) {
> --
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20150506/c44f4784/attachment-0002.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-mountpoint-fix-to-support-symlink-argument-with-x-op.patch
Type: application/octet-stream
Size: 791 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20150506/c44f4784/attachment-0002.obj>


More information about the Toybox mailing list