X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=client-src%2Fcalcsize.c;h=1336d8d1e553c0296d04c3ec04444d9da719c3ab;hb=621a0076ec80b352e52ba6f05f1729e254bfa423;hp=c6518b94aaa64c720b30535c3a420a82584c5fb0;hpb=34197d9f46a5f4e944378cbb65fca32ee0eec7b9;p=debian%2Famanda diff --git a/client-src/calcsize.c b/client-src/calcsize.c index c6518b9..1336d8d 100644 --- a/client-src/calcsize.c +++ b/client-src/calcsize.c @@ -24,7 +24,7 @@ * file named AUTHORS, in the root directory of this distribution. */ /* - * $Id: calcsize.c,v 1.44.2.1 2006/10/19 18:47:25 martinea Exp $ + * $Id: calcsize.c,v 1.44 2006/07/25 18:27:56 martinea Exp $ * * traverse directory tree to get backup size estimates * @@ -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; } @@ -484,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); @@ -560,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 */