refactor: Substitute some clunky code with a strdup()
.
This commit is contained in:
8
rc.c
8
rc.c
@@ -1245,13 +1245,11 @@ do_recursive_mkdir(const char *dir)
|
|||||||
size_t n;
|
size_t n;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
n = strlen(dir);
|
if (*dir == '\0')
|
||||||
if (n == 0)
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if ((dircpy = malloc(n + 1)) == NULL)
|
if ((dircpy = strdup(dir)) == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
strcpy(dircpy, dir);
|
|
||||||
|
|
||||||
ch = dircpy + 1;
|
ch = dircpy + 1;
|
||||||
do {
|
do {
|
||||||
|
Reference in New Issue
Block a user