X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=client-src%2Fcalcsize.c;h=1336d8d1e553c0296d04c3ec04444d9da719c3ab;hb=d92f70685083588e2a7ce6bc312a735f6937b5a6;hp=7d8ad04f0fa276b1ebf9ffd16c57a714f99453b5;hpb=ac973066bc508cb82728e46eaf499e9424d4e0f1;p=debian%2Famanda diff --git a/client-src/calcsize.c b/client-src/calcsize.c index 7d8ad04..1336d8d 100644 --- a/client-src/calcsize.c +++ b/client-src/calcsize.c @@ -32,7 +32,7 @@ * argv[1] is the config name or NOCONFIG */ #include "amanda.h" -#include "statfs.h" +#include "fsusage.h" #include "version.h" #include "sl.h" #include "util.h" @@ -128,6 +128,15 @@ main( char *d; int l, w; + /* + * Configure program for internationalization: + * 1) Only set the message locale for now. + * 2) Set textdomain for all amanda related programs to "amanda" + * We don't want to be forced to support dozens of message catalogs. + */ + setlocale(LC_MESSAGES, "C"); + textdomain("amanda"); + safe_fd(-1, 0); set_pname("calcsize"); @@ -138,29 +147,34 @@ main( signal(SIGPIPE, SIG_IGN); if (argc < 2) { - fprintf(stderr,"Usage: %s file[s]\n",argv[0]); + g_fprintf(stderr,_("Usage: %s file[s]\n"),argv[0]); return 1; } for(i=1; id_name); if(lstat(newname, &finfo) == -1) { - fprintf(stderr, "%s/%s: %s\n", + g_fprintf(stderr, "%s/%s: %s\n", dirname, f->d_name, strerror(errno)); continue; } @@ -479,6 +490,10 @@ traverse_dirs( perror(dirname); #endif } + + /* drop root privs -- we're done with the permission-sensitive calls */ + set_root_privs(0); + amfree(newbase); amfree(newname); amfree(aparent); @@ -555,20 +570,20 @@ final_size_dump( int level, char * topdir) { - generic_fs_stats_t stats; + struct fs_usage fsusage; off_t mapsize; char *s; /* calculate the map sizes */ s = stralloc2(topdir, "/."); - if(get_fs_stats(s, &stats) == -1) { + if(get_fs_usage(s, NULL, &fsusage) == -1) { error("statfs %s: %s", s, strerror(errno)); /*NOTREACHED*/ } amfree(s); - mapsize = (stats.files + (off_t)7) / (off_t)8; /* in bytes */ + mapsize = (fsusage.fsu_files + (off_t)7) / (off_t)8; /* in bytes */ mapsize = (mapsize + (off_t)1023) / (off_t)1024; /* in kbytes */ /* the dump contains three maps plus the files */