diff options
| author | Theodore Tso <tytso@mit.edu> | 1991-01-11 00:06:24 +0000 |
|---|---|---|
| committer | Theodore Tso <tytso@mit.edu> | 1991-01-11 00:06:24 +0000 |
| commit | 840acfce95299e82a771b43be981b5328f36cff8 (patch) | |
| tree | 5ddf2b3c55d64960dbd0b5ca29fc46c17ef87895 /src/admin | |
| parent | ebfa383ccb8b46ec6c2e6f24ca79d9e554254f2a (diff) | |
| download | krb5-840acfce95299e82a771b43be981b5328f36cff8.tar.gz krb5-840acfce95299e82a771b43be981b5328f36cff8.tar.xz krb5-840acfce95299e82a771b43be981b5328f36cff8.zip | |
Unlink the output dump file before we open it, to make sure we don't
stomp on a running kprop.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@1628 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/admin')
| -rw-r--r-- | src/admin/edit/dump.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/admin/edit/dump.c b/src/admin/edit/dump.c index 35f21e610..98220b51c 100644 --- a/src/admin/edit/dump.c +++ b/src/admin/edit/dump.c @@ -98,6 +98,17 @@ void dump_db(argc, argv) return; } if (argc == 2) { + /* + * Make sure that we don't open and truncate on the fopen, + * since that may hose an on-going kprop process. + * + * We could also control this by opening for read and + * write, doing an flock with LOCK_EX, and then + * truncating the file once we have gotten the lock, + * but that would involve more OS dependancies than I + * want to get into. + */ + unlink(argv[1]); if (!(f = fopen(argv[1], "w"))) { com_err(argv[0], errno, "While opening file %s for writing", argv[1]); |
