Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 930518 Details for
Bug 1108522
Various small fixes for RHEL 7.1 (corosync rebase)
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
corosync-keygen: Replace printf/exit call with err
tmp.HxefS3Mnmh (text/plain), 2.33 KB, created by
Jan Friesse
on 2014-08-25 14:36:44 UTC
(
hide
)
Description:
corosync-keygen: Replace printf/exit call with err
Filename:
MIME Type:
Creator:
Jan Friesse
Created:
2014-08-25 14:36:44 UTC
Size:
2.33 KB
patch
obsolete
>From 0ce8d51c6d989c4e62d8c1f3fc42785c4f3d250c Mon Sep 17 00:00:00 2001 >From: Jan Friesse <jfriesse@redhat.com> >Date: Mon, 21 Jul 2014 14:47:29 +0200 >Subject: [PATCH] corosync-keygen: Replace printf/exit call with err > >Calling of err makes code shorter, easier to read and eliminates >problems with forgotten newline characters. > >Signed-off-by: Jan Friesse <jfriesse@redhat.com> >Reviewed-by: Christine Caulfield <ccaulfie@redhat.com> >--- > tools/corosync-keygen.c | 20 +++++++------------- > 1 files changed, 7 insertions(+), 13 deletions(-) > >diff --git a/tools/corosync-keygen.c b/tools/corosync-keygen.c >index 112ebaf..668d6e9 100644 >--- a/tools/corosync-keygen.c >+++ b/tools/corosync-keygen.c >@@ -35,11 +35,11 @@ > > #include <config.h> > >+#include <err.h> > #include <stdio.h> > #include <stdlib.h> > #include <unistd.h> > #include <fcntl.h> >-#include <errno.h> > #include <string.h> > #include <getopt.h> > #include <sys/types.h> >@@ -112,8 +112,7 @@ int main (int argc, char *argv[]) > } > > if (random_fd == -1) { >- perror ("Failed to open random source\n"); >- exit (errno); >+ err (1, "Failed to open random source"); > } > > /* >@@ -124,8 +123,7 @@ int main (int argc, char *argv[]) > retry_read: > res = read (random_fd, &key[bytes_read], sizeof (key) - bytes_read); > if (res == -1) { >- perror ("Could not read /dev/random"); >- exit (errno); >+ err (1, "Could not read /dev/random"); > } > bytes_read += res; > if (bytes_read != sizeof (key)) { >@@ -139,12 +137,10 @@ retry_read: > */ > authkey_fd = open (keyfile, O_CREAT|O_WRONLY, 0600); > if (authkey_fd == -1) { >- fprintf (stderr, "Could not create %s: %s", keyfile, strerror(errno)); >- exit (errno); >+ err (2, "Could not create %s", keyfile); > } > if (fchmod (authkey_fd, 0400)) { >- perror ("Failed to set key file permissions to 0400\n"); >- exit (errno); >+ err (3, "Failed to set key file permissions to 0400"); > } > > printf ("Writing corosync key to %s.\n", keyfile); >@@ -154,13 +150,11 @@ retry_read: > */ > res = write (authkey_fd, key, sizeof (key)); > if (res != sizeof (key)) { >- fprintf (stderr, "Could not write %s: %s", keyfile, strerror(errno)); >- exit (errno); >+ err (4, "Could not write %s", keyfile); > } > > if (close (authkey_fd)) { >- fprintf (stderr, "Could not close %s: %s", keyfile, strerror(errno)); >- exit (errno); >+ err (5, "Could not close %s", keyfile); > } > > return (0); >-- >1.7.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1108522
:
907995
|
907996
|
907997
|
907998
|
907999
|
908004
|
908111
|
930505
|
930506
|
930507
|
930509
|
930510
|
930511
|
930512
|
930513
|
930514
|
930515
|
930516
|
930517
| 930518 |
930519
|
930527
|
930528
|
930529
|
930530
|
930531
|
930535
|
930536
|
930537
|
930538
|
930539
|
930540
|
931024