Skip to content

Commit

Permalink
daemon: Print device names when they are translated.
Browse files Browse the repository at this point in the history
This helps to debug problems with the new device name translation
code.  We can think about removing this later when the code is known
to work well.
  • Loading branch information
rwmjones committed Mar 6, 2020
1 parent bca9b94 commit a06262e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions daemon/device-name-translation.c
Expand Up @@ -191,6 +191,10 @@ device_name_translation (const char *device)
return NULL;
}

/* If the device name is different, print the translation. */
if (STRNEQ (device, ret))
fprintf (stderr, "device name translated: %s -> %s\n", device, ret);

/* Now check the device is openable. */
fd = open (ret, O_RDONLY|O_CLOEXEC);
if (fd >= 0) {
Expand Down Expand Up @@ -277,5 +281,9 @@ reverse_device_name_translation (const char *device)
}
}

/* If the device name is different, print the translation. */
if (STRNEQ (device, ret))
fprintf (stderr, "reverse device name translated: %s -> %s\n", device, ret);

return ret;
}

0 comments on commit a06262e

Please sign in to comment.