Show More
@@ -336,7 +336,7 b' static PyObject *makestat(const struct s' | |||
|
336 | 336 | static PyObject *_listdir_stat(char *path, int pathlen, int keepstat, |
|
337 | 337 | char *skip) |
|
338 | 338 | { |
|
339 |
PyObject *list, *elem, * |
|
|
339 | PyObject *list, *elem, *ret = NULL; | |
|
340 | 340 | char fullpath[PATH_MAX + 10]; |
|
341 | 341 | int kind, err; |
|
342 | 342 | struct stat st; |
@@ -409,7 +409,7 b' static PyObject *_listdir_stat(char *pat' | |||
|
409 | 409 | } |
|
410 | 410 | |
|
411 | 411 | if (keepstat) { |
|
412 | stat = makestat(&st); | |
|
412 | PyObject *stat = makestat(&st); | |
|
413 | 413 | if (!stat) |
|
414 | 414 | goto error; |
|
415 | 415 | elem = Py_BuildValue(PY23("siN", "yiN"), ent->d_name, |
@@ -419,7 +419,6 b' static PyObject *_listdir_stat(char *pat' | |||
|
419 | 419 | kind); |
|
420 | 420 | if (!elem) |
|
421 | 421 | goto error; |
|
422 | stat = NULL; | |
|
423 | 422 | |
|
424 | 423 | PyList_Append(list, elem); |
|
425 | 424 | Py_DECREF(elem); |
@@ -430,7 +429,6 b' static PyObject *_listdir_stat(char *pat' | |||
|
430 | 429 | |
|
431 | 430 | error: |
|
432 | 431 | Py_DECREF(list); |
|
433 | Py_XDECREF(stat); | |
|
434 | 432 | error_list: |
|
435 | 433 | closedir(dir); |
|
436 | 434 | /* closedir also closes its dirfd */ |
@@ -480,7 +478,7 b' int attrkind(attrbuf_entry *entry)' | |||
|
480 | 478 | static PyObject *_listdir_batch(char *path, int pathlen, int keepstat, |
|
481 | 479 | char *skip, bool *fallback) |
|
482 | 480 | { |
|
483 |
PyObject *list, *elem, * |
|
|
481 | PyObject *list, *elem, *ret = NULL; | |
|
484 | 482 | int kind, err; |
|
485 | 483 | unsigned long index; |
|
486 | 484 | unsigned int count, old_state, new_state; |
@@ -586,6 +584,7 b' static PyObject *_listdir_batch(char *pa' | |||
|
586 | 584 | } |
|
587 | 585 | |
|
588 | 586 | if (keepstat) { |
|
587 | PyObject *stat = NULL; | |
|
589 | 588 | /* from the getattrlist(2) man page: "Only the |
|
590 | 589 | permission bits ... are valid". */ |
|
591 | 590 | st.st_mode = (entry->access_mask & ~S_IFMT) | kind; |
@@ -601,7 +600,6 b' static PyObject *_listdir_batch(char *pa' | |||
|
601 | 600 | filename, kind); |
|
602 | 601 | if (!elem) |
|
603 | 602 | goto error; |
|
604 | stat = NULL; | |
|
605 | 603 | |
|
606 | 604 | PyList_Append(list, elem); |
|
607 | 605 | Py_DECREF(elem); |
@@ -615,7 +613,6 b' static PyObject *_listdir_batch(char *pa' | |||
|
615 | 613 | |
|
616 | 614 | error: |
|
617 | 615 | Py_DECREF(list); |
|
618 | Py_XDECREF(stat); | |
|
619 | 616 | error_dir: |
|
620 | 617 | close(dfd); |
|
621 | 618 | error_value: |
General Comments 0
You need to be logged in to leave comments.
Login now