- ftruncate(fileno(fp), 0);
- } else if ((fp = lkfopendata (seqfile, "w")) == NULL
- && (unlink (seqfile) == -1 ||
- (fp = lkfopendata (seqfile, "w")) == NULL)) {
- admonish (attr, "unable to write");
+ if (ftruncate(fileno(fp), 0) < 0) {
+ advise ("sequence file", "ftruncate");
+ }
+ } else if ((fp = lkfopendata (seqfile, "w", &failed_to_lock))
+ == NULL
+ && (m_unlink (seqfile) == -1 ||
+ (fp = lkfopendata (seqfile, "w", &failed_to_lock))
+ == NULL)) {
+ if (failed_to_lock) {
+ admonish (attr, "unable to lock");
+ } else {
+ admonish (attr, "unable to write");
+ }