From: mbuesch@freenet.de Date: Sun, 6 Feb 2005 02:23:43 +0000 (+0100) Subject: [PATCH] trivial: remove _all_ trailing slashes with no_trailing_slash() X-Git-Tag: 052~10 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e39515ac1fd303c0263ee4bc91f2d7699617d0bf;p=systemd [PATCH] trivial: remove _all_ trailing slashes with no_trailing_slash() This changes no_trailing_slash() to remove all trailing slashes and not just the last one. --- diff --git a/udev_utils.c b/udev_utils.c index 364037f7..5b0355d0 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -200,11 +200,11 @@ size_t buf_get_line(const char *buf, size_t buflen, size_t cur) void no_trailing_slash(char *path) { - int len; + size_t len; len = strlen(path); - if (len > 0 && path[len-1] == '/') - path[len-1] = '\0'; + while (len > 0 && path[len-1] == '/') + path[--len] = '\0'; } struct files {