649 |
static void |
static void |
650 |
mkcatdirs (const char *mandir, const char *catdir) |
mkcatdirs (const char *mandir, const char *catdir) |
651 |
{ |
{ |
652 |
char manname[PATH_MAX+6]; |
char *manname, *catname; |
|
char catname[PATH_MAX+6]; |
|
653 |
#ifdef SECURE_MAN_UID |
#ifdef SECURE_MAN_UID |
654 |
struct passwd *man_owner = get_man_owner (); |
struct passwd *man_owner = get_man_owner (); |
655 |
#endif |
#endif |
678 |
drop_effective_privs (); |
drop_effective_privs (); |
679 |
} |
} |
680 |
/* then the hierarchy */ |
/* then the hierarchy */ |
681 |
sprintf (catname, "%s/cat1", catdir); |
catname = strappend (NULL, catdir, "/cat1", NULL); |
682 |
|
manname = strappend (NULL, mandir, "/man1", NULL); |
683 |
if (is_directory (catdir) == 1) { |
if (is_directory (catdir) == 1) { |
684 |
int j; |
int j; |
685 |
regain_effective_privs (); |
regain_effective_privs (); |
688 |
"creating catdir hierarchy %s ", |
"creating catdir hierarchy %s ", |
689 |
catdir); |
catdir); |
690 |
for (j = 1; j <= 9; j++) { |
for (j = 1; j <= 9; j++) { |
691 |
sprintf (catname, "%s/cat%d", catdir, j); |
catname[strlen (catname) - 1] = '0' + j; |
692 |
sprintf (manname, "%s/man%d", mandir, j); |
manname[strlen (manname) - 1] = '0' + j; |
693 |
if ((is_directory (manname) == 1) |
if ((is_directory (manname) == 1) |
694 |
&& (is_directory (catname) != 1)) { |
&& (is_directory (catname) != 1)) { |
695 |
if (mkdir (catname, |
if (mkdir (catname, |
711 |
fprintf (stderr, "\n"); |
fprintf (stderr, "\n"); |
712 |
drop_effective_privs (); |
drop_effective_privs (); |
713 |
} |
} |
714 |
|
free (catname); |
715 |
|
free (manname); |
716 |
umask (oldmask); |
umask (oldmask); |
717 |
} |
} |
718 |
} |
} |