]> granicus.if.org Git - python/commitdiff
Made 2nd arg to mkdir optional
authorGuido van Rossum <guido@python.org>
Sun, 25 Feb 1996 04:50:32 +0000 (04:50 +0000)
committerGuido van Rossum <guido@python.org>
Sun, 25 Feb 1996 04:50:32 +0000 (04:50 +0000)
Modules/posixmodule.c

index ca311c4402d19c5af7d2e571b142d01ce8f68d61..3ecbc3582fb3f457891be87487a63c385237e68d 100644 (file)
@@ -485,7 +485,18 @@ posix_mkdir(self, args)
        object *self;
        object *args;
 {
-       return posix_strint(args, mkdir);
+       int res;
+       char *path;
+       int mode = 0777; /* Unused */
+       if (!newgetargs(args, "s|i", &path, &mode))
+               return NULL;
+       BGN_SAVE
+       res = mkdir(path, mode);
+       END_SAVE
+       if (res < 0)
+               return posix_error();
+       INCREF(None);
+       return None;
 }
 
 #ifdef HAVE_NICE
@@ -1407,7 +1418,7 @@ static struct methodlist posix_methods[] = {
 #endif /* HAVE_LINK */
        {"listdir",     posix_listdir},
        {"lstat",       posix_lstat},
-       {"mkdir",       posix_mkdir},
+       {"mkdir",       posix_mkdir, 1},
 #ifdef HAVE_NICE
        {"nice",        posix_nice},
 #endif /* HAVE_NICE */