Esempio n. 1
0
/*
 * Actually read the savefile
 */
errr rd_savefile(void)
{
	errr err;

	/* Grab permissions */
	safe_setuid_grab();

	/* The savefile is a binary file */
	fff = my_fopen(savefile, "rb");

	/* Drop permissions */
	safe_setuid_drop();

	/* Paranoia */
	if (!fff) return (-1);

	/* Call the sub-function */
	err = rd_savefile_new_aux();

	/* Check for errors */
	if (ferror(fff)) err = -1;

	/* Close the file */
	my_fclose(fff);

	/* Result */
	return (err);
}
Esempio n. 2
0
/*
 * Actually read the savefile
 */
int rd_savefile_old(void)
{
	errr err;

	/* Open savefile */
	safe_setuid_grab();
	fff = file_open(savefile, MODE_READ, -1);
	safe_setuid_drop();

	/* Paranoia */
	if (!fff) return (-1);

	/* Call the sub-function */
	err = rd_savefile_new_aux();

	/* Close the file */
	file_close(fff);

	/* Result */
	return (err);
}
Esempio n. 3
0
/*
 * Actually read the savefile
 *
 * Angband 2.8.0 will completely replace this code, see "save.c",
 * though this code will be kept to read pre-2.8.0 savefiles.
 */
errr rd_savefile_new(player_type *p_ptr)
{
	errr err;

	/* The savefile is a text file */
	file_handle = my_fopen(p_ptr->savefile, "r");

	/* Paranoia */
	if (!file_handle) return (-1);

	/* Call the sub-function */
	err = rd_savefile_new_aux(p_ptr);

	/* Check for errors */
	if (ferror(file_handle)) err = -1;

	/* Close the file */
	my_fclose(file_handle);

	/* Result */
	return (err);
}