[Secure Coding] master: Merge branch 'master' of git+ssh://git.fedorahosted.org/git/secure-coding (cd5d541)

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

 



Repository : http://git.fedorahosted.org/git/?p=secure-coding.git

On branch  : master

>---------------------------------------------------------------

commit cd5d541f38b537dae64a2cf314600f64f94f6bef
Merge: 56f3511 a9229ae
Author: Eric Christensen <echriste@xxxxxxxxxx>
Date:   Fri May 30 09:07:58 2014 -0400

    Merge branch 'master' of git+ssh://git.fedorahosted.org/git/secure-coding



>---------------------------------------------------------------

 .../en-US/snippets/Go-Error_Handling-IO.xml        |   25 ++++++++++++++++++++
 .../en-US/snippets/Go-Error_Handling-Regular.xml   |   23 ++++++++++++++++++
 2 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/defensive-coding/en-US/snippets/Go-Error_Handling-IO.xml b/defensive-coding/en-US/snippets/Go-Error_Handling-IO.xml
new file mode 100644
index 0000000..818d1da
--- /dev/null
+++ b/defensive-coding/en-US/snippets/Go-Error_Handling-IO.xml
@@ -0,0 +1,25 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<!DOCTYPE programlisting PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"; [
+]>
+<!-- Automatically generated file.  Do not edit. -->
+<programlisting language="C">
+func IOError(r io.Reader, buf []byte, processor Processor,
+	handler ErrorHandler) (message string, err error) {
+	n, err := r.Read(buf)
+	// First check for available data.
+	if n &#62; 0 {
+		message, err = processor.Process(buf[0:n])
+		// Regular error handling.
+		if err != nil {
+			handler.Handle(err)
+			return "", err
+		}
+	}
+	// Then handle any error.
+	if err != nil {
+		handler.Handle(err)
+		return "", err
+	}
+	return
+}
+</programlisting>
diff --git a/defensive-coding/en-US/snippets/Go-Error_Handling-Regular.xml b/defensive-coding/en-US/snippets/Go-Error_Handling-Regular.xml
new file mode 100644
index 0000000..c7f4bc7
--- /dev/null
+++ b/defensive-coding/en-US/snippets/Go-Error_Handling-Regular.xml
@@ -0,0 +1,23 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<!DOCTYPE programlisting PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"; [
+]>
+<!-- Automatically generated file.  Do not edit. -->
+<programlisting language="C">
+type Processor interface {
+	Process(buf []byte) (message string, err error)
+}
+
+type ErrorHandler interface {
+	Handle(err error)
+}
+
+func RegularError(buf []byte, processor Processor,
+	handler ErrorHandler) (message string, err error) {
+	message, err = processor.Process(buf)
+	if err != nil {
+		handler.Handle(err)
+		return "", err
+	}
+	return
+}
+</programlisting>

--
security mailing list
security@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/security





[Index of Archives]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Coolkey]

  Powered by Linux