RE: [PATCH v6 2/4] libusbg: Add fputs()/fgets() error handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Stanislaw Wadas
> Add error handling to fputs()/fgets() functions.
...
> -	fputs(buf, fp);
> +	if (fputs(buf, fp) == EOF) {
> +		ERROR("write error");
> +		fclose(fp);
> +		return;
> +	}

Pointless...
Most code that looks at the return value of fputs() or fprintf()
is broken.
What you probably want is:
	fputs(buf, fp);
	fflush(fp);
	err = ferror(fp);
	fclose(fp);
	if (err) ...

	David



--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux