Re: [PATCH 2/2](fix) added fputs() fgets() error handling

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

 



On 04.11.2013 17:22, Matt Porter wrote:
On Mon, Nov 04, 2013 at 04:09:39PM +0100, Stanislaw Wadas wrote:
Change-Id: I787380dda981c7cee6508a4ff566d7ca9fb273cf
Signed-off-by: Stanislaw Wadas <s.wadas@xxxxxxxxxxx>
Need a commit log entry for this one.

Can you please follow kernel conventions when posting/reposting?

Submit the updated series with a version and specify what the patch is
against. If we're going to review these on linux-usb, especially, it's
important to separate them out.

Should be "[PATCH v2 2/2] libusbg: added fputs()/fgets() error handling"

For libusbg I'd like to see the changelog over revisions of a patch
being reviewed under the --- marker line in your commit log entry.

e.g.

---------
Subject: [PATCH v2 2/2] libusbg: added fputs()/fgets() error handling

This patch adds foo using the bar implementation. This is need because
of baz.

Signed-off-by: Stanislaw Wadas <s.wadas@xxxxxxxxxxx>

---
Changes since v1:
	- fixed typos in MAX_LENGTH thoughout

  src/gadget.c |   12 +++++++++++-
  1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/gadget.c b/src/gadget.c

...
----------
Thank you for all your advice and sorry for the mess.
I have sent v3 of patch and i hope now all will be ok.


Best Regards
Stanislaw Wadas

---
  src/gadget.c |   12 +++++++++++-
  1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/gadget.c b/src/gadget.c
index faed675..ff4f3d5 100644
--- a/src/gadget.c
+++ b/src/gadget.c
@@ -93,6 +93,11 @@ static char *gadget_read_buf(char *path, char *name, char *file, char *buf)
  		goto out;
ret = fgets(buf, MAX_LENGTH, fp);
+	if (ret == NULL) {
+	ERROR("read error");
+	fclose(fp);
+	return ret;
+	}

Kernel coding style in this project, please. Please correct the
indentation throughout.

I'll add a copy of this in the project to make it clear.

-Matt

  	fclose(fp);
@@ -127,6 +132,7 @@ static void gadget_write_buf(char *path, char *name, char *file, char *buf)
  {
  	char p[MAX_LENGTH];
  	FILE *fp;
+	int ret;
sprintf(p, "%s/%s/%s", path, name, file); @@ -136,7 +142,11 @@ static void gadget_write_buf(char *path, char *name, char *file, char *buf)
  		return;
  	}
- fputs(buf, fp);
+	if (fputs(buf, fp) == EOF) {
+	ERROR("write error");
+	fclose(fp);
+	return;
+	}
fclose(fp);
  }
--
1.7.9.5


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