Changeset 5373:7f4711b9b61f for alias.c
Legend:
- Unmodified
- Added
- Removed
-
alias.c
r5019 r5373 332 332 return; 333 333 mutt_expand_path (buf, sizeof (buf)); 334 if ((rc = fopen (buf, "a"))) 335 { 334 if ((rc = fopen (buf, "a+"))) 335 { 336 /* terminate existing file with \n if necessary */ 337 if (fseek (rc, 0, SEEK_END)) 338 goto fseek_err; 339 if (ftell(rc) > 0) 340 { 341 if (fseek (rc, -1, SEEK_CUR) < 0) 342 goto fseek_err; 343 if (fread(buf, 1, 1, rc) < 0) 344 { 345 mutt_perror (_("Error reading alias file")); 346 return; 347 } 348 if (fseek (rc, 0, SEEK_END) < 0) 349 goto fseek_err; 350 if (buf[0] != '\n') 351 fputc ('\n', rc); 352 } 353 336 354 if (mutt_check_alias_name (new->name, NULL)) 337 355 mutt_quote_filename (buf, sizeof (buf), new->name); … … 348 366 else 349 367 mutt_perror (buf); 368 369 return; 370 371 fseek_err: 372 mutt_perror (_("Error seeking in alias file")); 373 fclose(rc); 374 return; 350 375 } 351 376
