From: Andre Noll Date: Fri, 6 Jun 2008 09:23:14 +0000 (+0200) Subject: fsck: --database-dir is required, no need to set defaults. X-Git-Tag: v0.1.0~64 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=825e42761d90d84b172da13dfa937773c5c73f6d;p=osl.git fsck: --database-dir is required, no need to set defaults. --- diff --git a/fsck.c b/fsck.c index 37195fc..dea7ad6 100644 --- a/fsck.c +++ b/fsck.c @@ -186,18 +186,6 @@ __must_check __malloc static char *para_strdup(const char *s) exit(EXIT_FAILURE); } -/** - * Get the home directory of the current user. - * - * \return A dynammically allocated string that must be freed by the caller. If - * the home directory could not be found, this function returns "/tmp". - */ -__must_check __malloc static char *para_homedir(void) -{ - struct passwd *pw = getpwuid(getuid()); - return para_strdup(pw? pw->pw_dir : "/tmp"); -} - /** * Compare two osl objects pointing to unsigned integers of 32 bit size. * @@ -1148,7 +1136,6 @@ static int check_all_tables(char *db_dir) int main(int argc, char **argv) { int i, ret; - char *db_dir = NULL; struct fsck_cmdline_parser_params params = { .override = 0, .initialize = 1, @@ -1164,20 +1151,13 @@ int main(int argc, char **argv) } loglevel = conf.loglevel_arg; HANDLE_VERSION_FLAG("fsck", conf); - if (conf.database_dir_given) - db_dir = para_strdup(conf.database_dir_arg); - else { - char *home = para_homedir(); - db_dir = make_message("%s/.paraslash/afs_database", home); - free(home); - } - INFO_LOG("database dir: %s\n", db_dir); + INFO_LOG("database dir: %s\n", conf.database_dir_arg); if (!conf.inputs_num) { - ret = check_all_tables(db_dir); + ret = check_all_tables(conf.database_dir_arg); goto out; } for (i = 0; i < conf.inputs_num; i++) { - ret = check_table(db_dir, conf.inputs[i]); + ret = check_table(conf.database_dir_arg, conf.inputs[i]); if (ret < 0) break; } @@ -1189,7 +1169,5 @@ out: conf.loglevel_arg - 1); } else NOTICE_LOG("success\n"); - if (db_dir) - free(db_dir); return ret < 0? EXIT_FAILURE : EXIT_SUCCESS; }