"Fossies" - the Fresh Open Source Software Archive

Member "swig-4.1.1/CCache/debian/patches/12_cachesize_permissions.diff" (30 Nov 2022, 2021 Bytes) of package /linux/misc/swig-4.1.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Diff source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 --- stats.c (révision 8804)
    2 +++ stats.c (copie de travail)
    3 @@ -286,7 +286,7 @@
    4  
    5  
    6  /* set the per directory limits */
    7 -void stats_set_limits(long maxfiles, long maxsize)
    8 +int stats_set_limits(long maxfiles, long maxsize)
    9  {
   10     int dir;
   11     unsigned counters[STATS_END];
   12 @@ -298,7 +298,9 @@
   13         maxsize /= 16;
   14     }
   15  
   16 -   create_dir(cache_dir);
   17 +   if (create_dir(cache_dir) != 0) {
   18 +       return 1;
   19 +   }
   20  
   21     /* set the limits in each directory */
   22     for (dir=0;dir<=0xF;dir++) {
   23 @@ -306,7 +308,9 @@
   24         int fd;
   25  
   26         x_asprintf(&cdir, "%s/%1x", cache_dir, dir);
   27 -       create_dir(cdir);
   28 +       if (create_dir(cdir) != 0) {
   29 +           return 1;
   30 +       }
   31         x_asprintf(&fname, "%s/stats", cdir);
   32         free(cdir);
   33  
   34 @@ -326,6 +330,8 @@
   35         }
   36         free(fname);
   37     }
   38 +
   39 +   return 0;
   40  }
   41  
   42  /* set the per directory sizes */
   43 --- ccache.c    (révision 8804)
   44 +++ ccache.c    (copie de travail)
   45 @@ -935,15 +934,23 @@
   46         case 'F':
   47             check_cache_dir();
   48             v = atoi(optarg);
   49 -           stats_set_limits(v, -1);
   50 -           printf("Set cache file limit to %u\n", (unsigned)v);
   51 +           if (stats_set_limits(v, -1) == 0) {
   52 +               printf("Set cache file limit to %u\n", (unsigned)v);
   53 +           } else {
   54 +               printf("Could not set cache file limit.\n");
   55 +               exit(1);
   56 +           }
   57             break;
   58  
   59         case 'M':
   60             check_cache_dir();
   61             v = value_units(optarg);
   62 -           stats_set_limits(-1, v);
   63 -           printf("Set cache size limit to %uk\n", (unsigned)v);
   64 +           if (stats_set_limits(-1, v) == 0) {
   65 +               printf("Set cache size limit to %uk\n", (unsigned)v);
   66 +           } else {
   67 +               printf("Could not set cache size limit.\n");
   68 +               exit(1);
   69 +           }
   70             break;
   71  
   72         default:
   73 --- ccache.h    (révision 8804)
   74 +++ ccache.h    (copie de travail)
   75 @@ -101,7 +101,7 @@
   76  void stats_summary(void);
   77  void stats_tocache(size_t size);
   78  void stats_read(const char *stats_file, unsigned counters[STATS_END]);
   79 -void stats_set_limits(long maxfiles, long maxsize);
   80 +int stats_set_limits(long maxfiles, long maxsize);
   81  size_t value_units(const char *s);
   82  void display_size(unsigned v);
   83  void stats_set_sizes(const char *dir, size_t num_files, size_t total_size);