Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/sh_files.c

    r27 r20  
    7272#define FIL__  _("sh_files.c")
    7373
     74extern int safe_logger (int signal, int method, pid_t thepid);
     75
    7476extern int flag_err_debug;
    7577extern int flag_err_info;
    7678
    77 int sh_files_reportonce(const char * c)
     79int sh_files_reportonce(char * c)
    7880{
    7981  int i;
     
    8486}
    8587   
    86 int sh_files_fulldetail(const char * c)
     88int sh_files_fulldetail(char * c)
    8789{
    8890  int i;
     
    154156static int        sh_files_fullpath  (char * testdir, char * d_name,
    155157                                      char * statpath);
    156 static int        sh_files_pushdir   (int class, const char * str_s);
    157 static int        sh_files_pushfile  (int class, const char * str_s);
     158static int        sh_files_pushdir   (int class, char * str_s);
     159static int        sh_files_pushfile  (int class, char * str_s);
    158160static int        sh_files_checkdir  (int class, int rdepth, char * dirName,
    159161                                      char * relativeName);
     
    444446
    445447
    446 int sh_files_pushfile_prelink (const char * str_s)
     448int sh_files_pushfile_prelink (char * str_s)
    447449{
    448450  return (sh_files_pushfile (SH_LEVEL_PRELINK, str_s));
    449451}
    450452
    451 int sh_files_pushfile_user0 (const char * str_s)
     453int sh_files_pushfile_user0 (char * str_s)
    452454{
    453455  return (sh_files_pushfile (SH_LEVEL_USER0, str_s));
    454456}
    455457
    456 int sh_files_pushfile_user1 (const char * str_s)
     458
     459int sh_files_pushfile_user1 (char * str_s)
    457460{
    458461  return (sh_files_pushfile (SH_LEVEL_USER1, str_s));
    459462}
    460463
    461 int sh_files_pushfile_user2 (const char * str_s)
    462 {
    463   return (sh_files_pushfile (SH_LEVEL_USER2, str_s));
    464 }
    465 
    466 int sh_files_pushfile_user3 (const char * str_s)
    467 {
    468   return (sh_files_pushfile (SH_LEVEL_USER3, str_s));
    469 }
    470 
    471 int sh_files_pushfile_user4 (const char * str_s)
    472 {
    473   return (sh_files_pushfile (SH_LEVEL_USER4, str_s));
    474 }
    475 
    476 
    477 int sh_files_pushfile_ro (const char * str_s)
     464
     465int sh_files_pushfile_ro (char * str_s)
    478466{
    479467  return (sh_files_pushfile (SH_LEVEL_READONLY, str_s));
    480468}
    481469
    482 int sh_files_pushfile_attr (const char * str_s)
     470int sh_files_pushfile_attr (char * str_s)
    483471{
    484472  return (sh_files_pushfile (SH_LEVEL_ATTRIBUTES, str_s));
    485473}
    486474
    487 int sh_files_pushfile_log (const char * str_s)
     475int sh_files_pushfile_log (char * str_s)
    488476{
    489477  return (sh_files_pushfile (SH_LEVEL_LOGFILES, str_s));
    490478}
    491479
    492 int sh_files_pushfile_glog (const char * str_s)
     480int sh_files_pushfile_glog (char * str_s)
    493481{
    494482  return (sh_files_pushfile (SH_LEVEL_LOGGROW, str_s));
    495483}
    496484
    497 int sh_files_pushfile_noig (const char * str_s)
     485int sh_files_pushfile_noig (char * str_s)
    498486{
    499487  return (sh_files_pushfile (SH_LEVEL_NOIGNORE, str_s));
    500488}
    501489
    502 int sh_files_pushfile_allig (const char * str_s)
     490int sh_files_pushfile_allig (char * str_s)
    503491{
    504492  return (sh_files_pushfile (SH_LEVEL_ALLIGNORE, str_s));
     
    523511/* set mask(class)
    524512 */
    525 static int sh_files_parse_mask (unsigned long * mask, const char * str)
     513static int sh_files_parse_mask (unsigned long * mask, char * str)
    526514{
    527515  int l, i = 0, act = 0, k = 0;
     
    614602}
    615603
    616 int sh_files_redef_prelink(const char * str)
     604int sh_files_redef_prelink(char * str)
    617605{
    618606  return (sh_files_parse_mask(&mask_PRELINK, str));
    619607}
    620 int sh_files_redef_user0(const char * str)
     608int sh_files_redef_user0(char * str)
    621609{
    622610  return (sh_files_parse_mask(&mask_USER0, str));
    623611}
    624 int sh_files_redef_user1(const char * str)
     612int sh_files_redef_user1(char * str)
    625613{
    626614  return (sh_files_parse_mask(&mask_USER1, str));
    627615}
    628 int sh_files_redef_user2(const char * str)
    629 {
    630   return (sh_files_parse_mask(&mask_USER2, str));
    631 }
    632 int sh_files_redef_user3(const char * str)
    633 {
    634   return (sh_files_parse_mask(&mask_USER3, str));
    635 }
    636 int sh_files_redef_user4(const char * str)
    637 {
    638   return (sh_files_parse_mask(&mask_USER4, str));
    639 }
    640 int sh_files_redef_readonly(const char * str)
     616int sh_files_redef_readonly(char * str)
    641617{
    642618  return (sh_files_parse_mask(&mask_READONLY, str));
    643619}
    644 int sh_files_redef_loggrow(const char * str)
     620int sh_files_redef_loggrow(char * str)
    645621{
    646622  return (sh_files_parse_mask(&mask_LOGGROW, str));
    647623}
    648 int sh_files_redef_logfiles(const char * str)
     624int sh_files_redef_logfiles(char * str)
    649625{
    650626  return (sh_files_parse_mask(&mask_LOGFILES, str));
    651627}
    652 int sh_files_redef_attributes(const char * str)
     628int sh_files_redef_attributes(char * str)
    653629{
    654630  return (sh_files_parse_mask(&mask_ATTRIBUTES, str));
    655631}
    656 int sh_files_redef_noignore(const char * str)
     632int sh_files_redef_noignore(char * str)
    657633{
    658634  return (sh_files_parse_mask(&mask_NOIGNORE, str));
    659635}
    660 int sh_files_redef_allignore(const char * str)
     636int sh_files_redef_allignore(char * str)
    661637{
    662638  return (sh_files_parse_mask(&mask_ALLIGNORE, str));
     
    683659    case SH_LEVEL_USER1:
    684660      return (unsigned long) mask_USER1;
    685     case SH_LEVEL_USER2:
    686       return (unsigned long) mask_USER2;
    687     case SH_LEVEL_USER3:
    688       return (unsigned long) mask_USER3;
    689     case SH_LEVEL_USER4:
    690       return (unsigned long) mask_USER4;
    691661    case SH_LEVEL_PRELINK:
    692662      return (unsigned long) mask_PRELINK;
     
    755725      if (zfileList == NULL)
    756726        {
    757           (void) safe_logger (0, 0, NULL);
     727          (void) safe_logger (0, 0, getpid());
    758728          aud__exit(FIL__, __LINE__, EXIT_FAILURE);
    759729        }
     
    764734  if (-1 == ret)
    765735    {
    766       (void) safe_logger (0, 0, NULL);
     736      (void) safe_logger (0, 0, getpid());
    767737      aud__exit(FIL__, __LINE__, EXIT_FAILURE);
    768738    }
     
    775745
    776746
    777 static int sh_files_pushfile (int class, const char * str_s)
    778 {
     747static int sh_files_pushfile (int class, char * str_s)
     748{
     749  char  * tmp;
    779750  int     len;
    780   char  * tmp;
    781   char  * p;
    782751#ifdef HAVE_GLOB_H
     752  glob_t  pglob;
    783753  int     globstatus = -1;
    784754  unsigned int     gloop;
    785   glob_t  pglob;
    786755#endif
    787756
     
    839808       * special case of the root directory.
    840809       */
    841       p = sh_util_strdup (str_s);
    842       if (p[len-1] == '/' && len > 1)
     810      if (str_s[len-1] == '/' && len > 1)
    843811        {
    844           p[len-1] = '\0';
     812          str_s[len-1] = '\0';
    845813          --len;
    846814        }
     
    849817
    850818#ifdef HAVE_GLOB_H
    851   if (0 == sh_files_has_metachar(p))
    852     {
    853       sh_files_push_file_int (class, p, len);
     819  if (0 == sh_files_has_metachar(str_s))
     820    {
     821      sh_files_push_file_int (class, str_s, len);
    854822    }
    855823  else
    856824    {
    857825      pglob.gl_offs = 0;
    858       globstatus    = glob (p, 0, sh_files_globerr, &pglob);
     826      globstatus    = glob (str_s, 0, sh_files_globerr, &pglob);
    859827
    860828      if (globstatus == 0 && pglob.gl_pathc > 0)
     
    866834      else
    867835        {
    868           tmp = sh_util_safe_name (p);
     836          tmp = sh_util_safe_name (str_s);
    869837
    870838          if (pglob.gl_pathc == 0
     
    901869
    902870#else
    903   sh_files_push_file_int (class, p, len);
    904 #endif
    905 
    906   SH_FREE(p);
     871  sh_files_push_file_int (class, str_s, len);
     872#endif
     873
    907874  SL_RETURN((0),_("sh_files_pushfile"));
    908875}
     
    10611028}
    10621029
    1063 int sh_files_pushdir_prelink (const char * str_s)
     1030int sh_files_pushdir_prelink (char * str_s)
    10641031{
    10651032  return (sh_files_pushdir (SH_LEVEL_PRELINK, str_s));
    10661033}
    10671034
    1068 int sh_files_pushdir_user0 (const char * str_s)
     1035int sh_files_pushdir_user0 (char * str_s)
    10691036{
    10701037  return (sh_files_pushdir (SH_LEVEL_USER0, str_s));
    10711038}
    10721039
    1073 int sh_files_pushdir_user1 (const char * str_s)
     1040int sh_files_pushdir_user1 (char * str_s)
    10741041{
    10751042  return (sh_files_pushdir (SH_LEVEL_USER1, str_s));
    10761043}
    10771044
    1078 int sh_files_pushdir_user2 (const char * str_s)
    1079 {
    1080   return (sh_files_pushdir (SH_LEVEL_USER2, str_s));
    1081 }
    1082 
    1083 int sh_files_pushdir_user3 (const char * str_s)
    1084 {
    1085   return (sh_files_pushdir (SH_LEVEL_USER3, str_s));
    1086 }
    1087 
    1088 int sh_files_pushdir_user4 (const char * str_s)
    1089 {
    1090   return (sh_files_pushdir (SH_LEVEL_USER4, str_s));
    1091 }
    1092 
    1093 int sh_files_pushdir_attr (const char * str_s)
     1045int sh_files_pushdir_attr (char * str_s)
    10941046{
    10951047  return (sh_files_pushdir (SH_LEVEL_ATTRIBUTES, str_s));
    10961048}
    10971049
    1098 int sh_files_pushdir_ro (const char * str_s)
     1050int sh_files_pushdir_ro (char * str_s)
    10991051{
    11001052  return (sh_files_pushdir (SH_LEVEL_READONLY, str_s));
    11011053}
    11021054
    1103 int sh_files_pushdir_log (const char * str_s)
     1055int sh_files_pushdir_log (char * str_s)
    11041056{
    11051057  return (sh_files_pushdir (SH_LEVEL_LOGFILES, str_s));
    11061058}
    11071059
    1108 int sh_files_pushdir_glog (const char * str_s)
     1060int sh_files_pushdir_glog (char * str_s)
    11091061{
    11101062  return (sh_files_pushdir (SH_LEVEL_LOGGROW, str_s));
    11111063}
    11121064
    1113 int sh_files_pushdir_noig (const char * str_s)
     1065int sh_files_pushdir_noig (char * str_s)
    11141066{
    11151067  return (sh_files_pushdir (SH_LEVEL_NOIGNORE, str_s));
    11161068}
    11171069
    1118 int sh_files_pushdir_allig (const char * str_s)
     1070int sh_files_pushdir_allig (char * str_s)
    11191071{
    11201072  return (sh_files_pushdir (SH_LEVEL_ALLIGNORE, str_s));
     
    11681120      if (tree == NULL)
    11691121        {
    1170           (void) safe_logger (0, 0, NULL);
     1122          (void) safe_logger (0, 0, getpid());
    11711123          aud__exit(FIL__, __LINE__, EXIT_FAILURE);
    11721124        }
     
    11811133  if (-1 == ret)
    11821134    {
    1183       (void) safe_logger (0, 0, NULL);
     1135      (void) safe_logger (0, 0, getpid());
    11841136      aud__exit(FIL__, __LINE__, EXIT_FAILURE);
    11851137    }
     
    11911143}
    11921144
    1193 static int sh_files_pushdir (int class, const char * str_s)
     1145static int sh_files_pushdir (int class, char * str_s)
    11941146{
    11951147  char  * tmp;
     
    11971149  int     rdepth = 0;
    11981150  char  * tail = NULL;
    1199   char  * p;
    12001151
    12011152#ifdef HAVE_GLOB_H
     
    12151166    SL_RETURN((-1), _("sh_files_pushdir"));
    12161167 
    1217   p = sh_util_strdup (str_s);
    1218 
    1219   if (p[0] != '/')
    1220     {
    1221       rdepth = strtol(p, &tail, 10);
    1222       if (tail == p)
    1223         {
    1224           SH_FREE(p);
    1225           SL_RETURN((-1), _("sh_files_pushdir"));
    1226         }
     1168
     1169  if (str_s[0] != '/')
     1170    {
     1171      rdepth = strtol(str_s, &tail, 10);
     1172      if (tail == str_s)
     1173        SL_RETURN((-1), _("sh_files_pushdir"));
    12271174    }
    12281175  else
    1229     tail   = p;
     1176    tail   = str_s;
    12301177 
    12311178
    1232   if (rdepth < (-1) || tail == p || rdepth > 99)
     1179  if (rdepth < (-1) || tail == str_s || rdepth > 99)
    12331180    rdepth = (-2);
    12341181
     
    12411188                       tmp);
    12421189      SH_FREE(tmp);
    1243       SH_FREE(p);
    12441190      SL_RETURN((-1), _("sh_files_pushdir"));
    12451191    }
    12461192  else if (len < 1)
    12471193    {
    1248       SH_FREE(p);
    12491194      SL_RETURN((-1), _("sh_files_pushdir"));
    12501195    }
     
    12551200                       tmp);
    12561201      SH_FREE(tmp);
    1257       SH_FREE(p);
    12581202      SL_RETURN((-1), _("sh_files_pushdir"));
    12591203    }
     
    13241268#endif
    13251269
    1326   SH_FREE(p);
    13271270  SL_RETURN((0), _("sh_files_pushdir"));
    13281271
     
    13791322/* Simply sets our boolean as to whether this check is active
    13801323 */
    1381 int sh_files_check_hardlinks (const char * opt)
     1324int sh_files_check_hardlinks (char * opt)
    13821325{
    13831326  int i;
     
    13951338static struct sh_hle_struct * sh_hl_exc = NULL;
    13961339
    1397 int sh_files_hle_reg (const char * str)
     1340int sh_files_hle_reg (char * str)
    13981341{
    13991342  long   offset;
Note: See TracChangeset for help on using the changeset viewer.