]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/basic/device-nodes.c
meson: make user $PATH configurable
[thirdparty/systemd.git] / src / basic / device-nodes.c
index ec58cfdd4cd207a594df22e04b40cff8766a04b8..5ebe5b24832c0d58d806ffed3a6db7ca819dc63c 100644 (file)
@@ -1,23 +1,4 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
-/***
-  This file is part of systemd.
-
-  Copyright 2008-2011 Kay Sievers
-
-  systemd is free software; you can redistribute it and/or modify it
-  under the terms of the GNU Lesser General Public License as published by
-  the Free Software Foundation; either version 2.1 of the License, or
-  (at your option) any later version.
-
-  systemd is distributed in the hope that it will be useful, but
-  WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  Lesser General Public License for more details.
-
-  You should have received a copy of the GNU Lesser General Public License
-  along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
+/* SPDX-License-Identifier: LGPL-2.1+ */
 
 #include <errno.h>
 #include <stdio.h>
@@ -41,13 +22,13 @@ int whitelisted_char_for_devnode(char c, const char *white) {
 int encode_devnode_name(const char *str, char *str_enc, size_t len) {
         size_t i, j;
 
-        if (str == NULL || str_enc == NULL)
+        if (!str || !str_enc)
                 return -EINVAL;
 
         for (i = 0, j = 0; str[i] != '\0'; i++) {
                 int seqlen;
 
-                seqlen = utf8_encoded_valid_unichar(&str[i]);
+                seqlen = utf8_encoded_valid_unichar(str + i, (size_t) -1);
                 if (seqlen > 1) {
 
                         if (len-j < (size_t)seqlen)