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

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

 



Hello David,

On 22.01.2014 17:05, David Laight wrote:
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) ...
thank you for all your advice, they will be included in next patchset,
but I agree with Krzysztof and I have only left inline untouched.


Best regards
Stanislaw Wadas
	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



--
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