/mandos/release

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/release

« back to all changes in this revision

Viewing changes to plugin-runner.c

  • Committer: Teddy Hogeborn
  • Date: 2014-03-01 09:47:01 UTC
  • mto: (237.7.272 trunk)
  • mto: This revision was merged to the branch mainline in revision 311.
  • Revision ID: teddy@recompile.se-20140301094701-j0vpnc0fyil6tpdn
* plugin-runner.c (main): Declare "bad_prefixes" and "bad_suffixes"
                          correctly.  Also fix resulting issues with
                          casting to non-const and suppress the
                          warnings thereof.

Show diffs side-by-side

added added

removed removed

Lines of Context:
850
850
    {
851
851
      bool bad_name = false;
852
852
      
853
 
      const char const *bad_prefixes[] = { ".", "#", NULL };
 
853
      const char * const bad_prefixes[] = { ".", "#", NULL };
854
854
      
855
 
      const char const *bad_suffixes[] = { "~", "#", ".dpkg-new",
 
855
      const char * const bad_suffixes[] = { "~", "#", ".dpkg-new",
856
856
                                           ".dpkg-old",
857
857
                                           ".dpkg-bak",
858
858
                                           ".dpkg-divert", NULL };
859
 
      for(const char **pre = bad_prefixes; *pre != NULL; pre++){
 
859
#pragma GCC diagnostic push
 
860
#pragma GCC diagnostic ignored "-Wcast-qual"
 
861
      for(const char **pre = (const char **)bad_prefixes;
 
862
          *pre != NULL; pre++){
 
863
#pragma GCC diagnostic pop
860
864
        size_t pre_len = strlen(*pre);
861
865
        if((d_name_len >= pre_len)
862
866
           and strncmp((dirst->d_name), *pre, pre_len) == 0){
871
875
      if(bad_name){
872
876
        continue;
873
877
      }
874
 
      for(const char **suf = bad_suffixes; *suf != NULL; suf++){
 
878
#pragma GCC diagnostic push
 
879
#pragma GCC diagnostic ignored "-Wcast-qual"
 
880
      for(const char **suf = (const char **)bad_suffixes;
 
881
          *suf != NULL; suf++){
 
882
#pragma GCC diagnostic pop
875
883
        size_t suf_len = strlen(*suf);
876
884
        if((d_name_len >= suf_len)
877
885
           and (strcmp((dirst->d_name) + d_name_len-suf_len, *suf)
1071
1079
      goto fallback;
1072
1080
    }
1073
1081
    
 
1082
#if defined (__GNUC__) and defined (__GLIBC__)
 
1083
#if not __GLIBC_PREREQ(2, 16)
 
1084
#pragma GCC diagnostic push
 
1085
#pragma GCC diagnostic ignored "-Wsign-conversion"
 
1086
#endif
 
1087
#endif
1074
1088
    FD_SET(new_plugin->fd, &rfds_all); /* Spurious warning from
1075
 
                                          -Wconversion */
 
1089
                                          -Wconversion in GNU libc
 
1090
                                          before 2.16 */
 
1091
#if defined (__GNUC__) and defined (__GLIBC__)
 
1092
#if not __GLIBC_PREREQ(2, 16)
 
1093
#pragma GCC diagnostic pop
 
1094
#endif
 
1095
#endif
1076
1096
    
1077
1097
    if(maxfd < new_plugin->fd){
1078
1098
      maxfd = new_plugin->fd;
1132
1152
          }
1133
1153
          
1134
1154
          /* Remove the plugin */
 
1155
#if defined (__GNUC__) and defined (__GLIBC__)
 
1156
#if not __GLIBC_PREREQ(2, 16)
 
1157
#pragma GCC diagnostic push
 
1158
#pragma GCC diagnostic ignored "-Wsign-conversion"
 
1159
#endif
 
1160
#endif
1135
1161
          FD_CLR(proc->fd, &rfds_all); /* Spurious warning from
1136
 
                                          -Wconversion */
 
1162
                                          -Wconversion in GNU libc
 
1163
                                          before 2.16 */
 
1164
#if defined (__GNUC__) and defined (__GLIBC__)
 
1165
#if not __GLIBC_PREREQ(2, 16)
 
1166
#pragma GCC diagnostic pop
 
1167
#endif
 
1168
#endif
1137
1169
          
1138
1170
          /* Block signal while modifying process_list */
1139
1171
          ret = (int)TEMP_FAILURE_RETRY(sigprocmask
1179
1211
      }
1180
1212
      
1181
1213
      /* This process has not completed.  Does it have any output? */
 
1214
#if defined (__GNUC__) and defined (__GLIBC__)
 
1215
#if not __GLIBC_PREREQ(2, 16)
 
1216
#pragma GCC diagnostic push
 
1217
#pragma GCC diagnostic ignored "-Wsign-conversion"
 
1218
#endif
 
1219
#endif
1182
1220
      if(proc->eof or not FD_ISSET(proc->fd, &rfds)){ /* Spurious
1183
1221
                                                         warning from
1184
 
                                                         -Wconversion */
 
1222
                                                         -Wconversion
 
1223
                                                         in GNU libc
 
1224
                                                         before
 
1225
                                                         2.16 */
 
1226
#if defined (__GNUC__) and defined (__GLIBC__)
 
1227
#if not __GLIBC_PREREQ(2, 16)
 
1228
#pragma GCC diagnostic pop
 
1229
#endif
 
1230
#endif
1185
1231
        /* This process had nothing to say at this time */
1186
1232
        proc = proc->next;
1187
1233
        continue;