summaryrefslogtreecommitdiffstats
path: root/shlibs/mount/src/tab.c
diff options
context:
space:
mode:
Diffstat (limited to 'shlibs/mount/src/tab.c')
-rw-r--r--shlibs/mount/src/tab.c84
1 files changed, 0 insertions, 84 deletions
diff --git a/shlibs/mount/src/tab.c b/shlibs/mount/src/tab.c
index 939e8c876..c61571d1c 100644
--- a/shlibs/mount/src/tab.c
+++ b/shlibs/mount/src/tab.c
@@ -652,90 +652,6 @@ mnt_fs *mnt_tab_find_source(mnt_tab *tb, const char *source, int direction)
return fs;
}
-
-/**
- * mnt_tab_fprintf:
- * @tb: tab pointer
- * @f: FILE
- * @fmt: per line printf-like format string (see MNT_TAB_PRINTFMT)
- *
- * Returns: 0 on success, -1 in case of error.
- */
-int mnt_tab_fprintf(mnt_tab *tb, FILE *f, const char *fmt)
-{
- mnt_iter itr;
- mnt_fs *fs;
-
- assert(f);
- assert(fmt);
- assert(tb);
-
- if (!f || !fmt || !tb)
- return -1;
-
- mnt_reset_iter(&itr, MNT_ITER_FORWARD);
- while(mnt_tab_next_fs(tb, &itr, &fs) == 0) {
- if (mnt_fs_fprintf(fs, f, fmt) == -1)
- return -1;
- }
-
- return 0;
-}
-
-/**
- * mnt_tab_update_file
- * @tb: tab pointer
- *
- * Writes tab to disk. Don't forget to lock the file (see mnt_lock()).
- *
- * Returns: 0 on success, -1 in case of error.
- */
-int mnt_tab_update_file(mnt_tab *tb, const char *filename)
-{
- FILE *f = NULL;
- char tmpname[PATH_MAX];
- struct stat st;
- int fd;
-
- assert(tb);
- if (!tb)
- goto error;
-
- if (snprintf(tmpname, sizeof(tmpname), "%s.tmp", filename)
- >= sizeof(tmpname))
- goto error;
-
- f = fopen(tmpname, "w");
- if (!f)
- goto error;
-
- if (mnt_tab_fprintf(tb, f, MNT_TAB_PRINTFMT) != 0)
- goto error;
-
- fd = fileno(f);
-
- if (fchmod(fd, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH) < 0)
- goto error;
-
- /* Copy uid/gid from the present file before renaming. */
- if (stat(filename, &st) == 0) {
- if (fchown(fd, st.st_uid, st.st_gid) < 0)
- goto error;
- }
-
- fclose(f);
- f = NULL;
-
- if (rename(tmpname, filename) < 0)
- goto error;
-
- return 0;
-error:
- if (f)
- fclose(f);
- return -1;
-}
-
#ifdef TEST_PROGRAM
static int parser_errcb(mnt_tab *tb, const char *filename, int line, int flag)