X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=udev_utils_file.c;h=e4d5802ff899824b6960a7369e150108c6d66dd9;hb=fc6da921ad3bcb251aa317376e81701700e925c9;hp=cd9c244f0f3d1b799f58063032ba2da959c6e3b5;hpb=0da0efb2b622435209d183b49e2d16d426142b2c;p=elogind.git diff --git a/udev_utils_file.c b/udev_utils_file.c index cd9c244f0..e4d5802ff 100644 --- a/udev_utils_file.c +++ b/udev_utils_file.c @@ -1,6 +1,4 @@ /* - * udev_utils_file.c - files operations - * * Copyright (C) 2004-2005 Kay Sievers * * This program is free software; you can redistribute it and/or modify it @@ -14,7 +12,7 @@ * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., - * 675 Mass Ave, Cambridge, MA 02139, USA. + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ @@ -30,11 +28,7 @@ #include #include -#include "udev_libc_wrapper.h" #include "udev.h" -#include "logging.h" -#include "udev_utils.h" -#include "list.h" int create_path(const char *path) { @@ -53,7 +47,7 @@ int create_path(const char *path) pos[0] = '\0'; dbg("stat '%s'\n", p); - if (stat (p, &stats) == 0 && (stats.st_mode & S_IFMT) == S_IFDIR) + if (stat(p, &stats) == 0 && (stats.st_mode & S_IFMT) == S_IFDIR) return 0; if (create_path (p) != 0) @@ -71,6 +65,9 @@ int delete_path(const char *path) strcpy (p, path); pos = strrchr(p, '/'); + if (pos == p || pos == NULL) + return 0; + while (1) { *pos = '\0'; pos = strrchr(p, '/');