X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=perl%2FAmanda%2FUtil.pm;h=a40c05b0b54969614f3b13a01d2bcbff33e42ca7;hb=fb2bd066c2f8b34addafe48d62550e3033a59431;hp=732e80adc3986a6b540c5321fefc2f97b879a4c4;hpb=94a044f90357edefa6f4ae9f0b1d5885b0e34aee;p=debian%2Famanda diff --git a/perl/Amanda/Util.pm b/perl/Amanda/Util.pm index 732e80a..a40c05b 100644 --- a/perl/Amanda/Util.pm +++ b/perl/Amanda/Util.pm @@ -92,38 +92,49 @@ Application initialization generally looks like this: =item C -Set up the operating environment for an application, without requiring -any configuration. +Set up the operating environment for an application, without requiring any +configuration. + +C<$name> is the name of the application, used in log messages, etc. C<$type> +is usualy one of "server" or "client". It specifies the subdirectory in which +debug logfiles will be created. C<$context> indicates the usual manner in +which this application is invoked; one of C<"cmdline"> for a user-invoked +command-line utility (e.g., C) which should send human-readable error +messages to stderr; C<"daemon"> for a program started by C, e.g., +C; or C<"scriptutil"> for a small program used from shell scripts, +e.g., C + +Based on C<$type> and C<$context>, this function does the following: =over -=item C<$name> is the name of the application, used in log messages, etc. +=item * -=item C<$type> is one of "server" or "client". +sets up debug logging; -=item C<$context> is one of "cmdline" for a user-invoked command-line -utility (e.g., C) or "daemon" for a program started by -C. (TODO: daemon is not supported yet) +=item * -=back +configures internationalization -Based on C<$type> and C<$context>, this function does the following: +=item * -=over +sets the umask; -=item sets up debug logging; +=item * -=item configures internationalization +sets the current working directory to the debug or temporary directory; -=item sets the umask; +=item * -=item sets the current working directory to the debug or temporary directory; +closes any unnecessary file descriptors as a security meaasure; -=item closes any unnecessary file descriptors as a security meaasure; +=item * -=item ignores C; and +ignores C; and -=item sets the appropriate target for error messages. +=item * + +sets the appropriate target for error messages. =back @@ -194,7 +205,7 @@ sub finish_setup { check_running_as($running_as); } -=item safe_env +=item C Return a "safe" environment hash. For non-setuid programs, this means filtering out any localization variables. @@ -271,4 +282,8 @@ sub check_std_fds { fcntl(STDOUT, F_GETFD, 0) or critical("Standard output is not open"); fcntl(STDERR, F_GETFD, 0) or critical("Standard error is not open"); } + +=back + +=cut 1;