Don't like ads? PRO users don't see any ads ;-)
Guest

paste from pastebinc

By: a guest on May 1st, 2012  |  syntax: None  |  size: 1.67 KB  |  hits: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. diff --git a/archival/unzip.c b/archival/unzip.c
  2. index 3c76cda..c1b945a 100644
  3. --- a/archival/unzip.c
  4. +++ b/archival/unzip.c
  5. @@ -596,7 +596,7 @@ int unzip_main(int argc, char **argv)
  6.                                                 printf("   creating: %s\n", dst_fn);
  7.                                         }
  8.                                         unzip_create_leading_dirs(dst_fn);
  9. -                                       if (bb_make_directory(dst_fn, dir_mode, 0)) {
  10. +                                       if (bb_make_directory(dst_fn, dir_mode, FILEUTILS_IGNORE_CHMOD_ERR)) {
  11.                                                 xfunc_die();
  12.                                         }
  13.                                 } else {
  14. diff --git a/include/libbb.h b/include/libbb.h
  15. index f12800f..5e5c8c7 100644
  16. --- a/include/libbb.h
  17. +++ b/include/libbb.h
  18. @@ -333,6 +333,7 @@ enum {      /* DO NOT CHANGE THESE VALUES!  cp.c, mv.c, install.c depend on them. */
  19.         FILEUTILS_PRESERVE_SECURITY_CONTEXT = 1 << 9, /* -c */
  20.         FILEUTILS_SET_SECURITY_CONTEXT = 1 << 10,
  21.  #endif
  22. +       FILEUTILS_IGNORE_CHMOD_ERR = 1 << 11,
  23.  };
  24.  #define FILEUTILS_CP_OPTSTR "pdRfilsLH" IF_SELINUX("c")
  25.  extern int remove_file(const char *path, int flags) FAST_FUNC;
  26. diff --git a/libbb/make_directory.c b/libbb/make_directory.c
  27. index 72303e7..7826b90 100644
  28. --- a/libbb/make_directory.c
  29. +++ b/libbb/make_directory.c
  30. @@ -107,6 +107,10 @@ int FAST_FUNC bb_make_directory(char *path, long mode, int flags)
  31.                          * an error. */
  32.                         if ((mode != -1) && (chmod(path, mode) < 0)) {
  33.                                 fail_msg = "set permissions of";
  34. +                               if (flags & FILEUTILS_IGNORE_CHMOD_ERR) {
  35. +                                       flags = 0;
  36. +                                       goto print_err;
  37. +                               }
  38.                                 break;
  39.                         }
  40.                         goto ret0;
  41. @@ -116,8 +120,9 @@ int FAST_FUNC bb_make_directory(char *path, long mode, int flags)
  42.                 *s = c;
  43.         } /* while (1) */
  44.  
  45. -       bb_perror_msg("can't %s directory '%s'", fail_msg, path);
  46.         flags = -1;
  47. + print_err:
  48. +       bb_perror_msg("can't %s directory '%s'", fail_msg, path);
  49.         goto ret;
  50.   ret0:
  51.         flags = 0;