public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2/daemons/common daemon-client.c
@ 2012-01-25 21:32 zkabelac
0 siblings, 0 replies; 5+ messages in thread
From: zkabelac @ 2012-01-25 21:32 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2012-01-25 21:31:59
Modified files:
daemons/common : daemon-client.c
Log message:
Ensure reply struct has all fields defined
Reply is returned by value.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/common/daemon-client.c.diff?cvsroot=lvm2&r1=1.10&r2=1.11
--- LVM2/daemons/common/daemon-client.c 2012/01/15 15:16:50 1.10
+++ LVM2/daemons/common/daemon-client.c 2012/01/25 21:31:59 1.11
@@ -34,7 +34,7 @@
daemon_reply daemon_send(daemon_handle h, daemon_request rq)
{
- daemon_reply reply;
+ daemon_reply reply = { .cft = NULL };
assert(h.socket_fd >= 0);
if (!rq.buffer) {
^ permalink raw reply [flat|nested] 5+ messages in thread
* LVM2/daemons/common daemon-client.c
@ 2012-02-27 11:49 zkabelac
0 siblings, 0 replies; 5+ messages in thread
From: zkabelac @ 2012-02-27 11:49 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2012-02-27 11:49:16
Modified files:
daemons/common : daemon-client.c
Log message:
Do not hide deallocation of buffer
As API is passing structures by value, do not leave
the function which created buffer and keeps valid pointer
look like it would be some memory leak and move
free of buffer from inner function - makes more obvious,
how is the memory management handled.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/common/daemon-client.c.diff?cvsroot=lvm2&r1=1.15&r2=1.16
--- LVM2/daemons/common/daemon-client.c 2012/02/26 08:46:28 1.15
+++ LVM2/daemons/common/daemon-client.c 2012/02/27 11:49:16 1.16
@@ -62,8 +62,6 @@
if (!write_buffer(h.socket_fd, rq.buffer, strlen(rq.buffer)))
reply.error = errno;
- dm_free(rq.buffer);
-
if (read_buffer(h.socket_fd, &reply.buffer)) {
reply.cft = dm_config_from_string(reply.buffer);
} else
@@ -93,6 +91,8 @@
return err;
repl = daemon_send(h, rq);
+ dm_free(rq.buffer);
+
return repl;
}
^ permalink raw reply [flat|nested] 5+ messages in thread
* LVM2/daemons/common daemon-client.c
@ 2012-02-24 0:02 mornfall
0 siblings, 0 replies; 5+ messages in thread
From: mornfall @ 2012-02-24 0:02 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: mornfall@sourceware.org 2012-02-24 00:02:54
Modified files:
daemons/common : daemon-client.c
Log message:
Fix an error path in daemon_open.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/common/daemon-client.c.diff?cvsroot=lvm2&r1=1.13&r2=1.14
--- LVM2/daemons/common/daemon-client.c 2012/02/23 23:52:11 1.13
+++ LVM2/daemons/common/daemon-client.c 2012/02/24 00:02:54 1.14
@@ -10,6 +10,7 @@
daemon_handle daemon_open(daemon_info i) {
daemon_handle h = { .protocol_version = 0 };
+ daemon_reply r = { .cft = NULL };
struct sockaddr_un sockaddr;
if ((h.socket_fd = socket(PF_UNIX, SOCK_STREAM /* | SOCK_NONBLOCK */, 0)) < 0) {
@@ -25,7 +26,7 @@
goto error;
}
- daemon_reply r = daemon_send_simple(h, "hello", NULL);
+ r = daemon_send_simple(h, "hello", NULL);
if (r.error || strcmp(daemon_reply_str(r, "response", "unknown"), "OK"))
goto error;
^ permalink raw reply [flat|nested] 5+ messages in thread
* LVM2/daemons/common daemon-client.c
@ 2012-02-15 9:14 mornfall
0 siblings, 0 replies; 5+ messages in thread
From: mornfall @ 2012-02-15 9:14 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: mornfall@sourceware.org 2012-02-15 09:14:54
Modified files:
daemons/common : daemon-client.c
Log message:
Do not forget to initialise the error value in daemon_reply.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/common/daemon-client.c.diff?cvsroot=lvm2&r1=1.11&r2=1.12
--- LVM2/daemons/common/daemon-client.c 2012/01/25 21:31:59 1.11
+++ LVM2/daemons/common/daemon-client.c 2012/02/15 09:14:54 1.12
@@ -34,7 +34,7 @@
daemon_reply daemon_send(daemon_handle h, daemon_request rq)
{
- daemon_reply reply = { .cft = NULL };
+ daemon_reply reply = { .cft = NULL, .error = 0 };
assert(h.socket_fd >= 0);
if (!rq.buffer) {
^ permalink raw reply [flat|nested] 5+ messages in thread
* LVM2/daemons/common daemon-client.c
@ 2011-06-27 13:14 mornfall
0 siblings, 0 replies; 5+ messages in thread
From: mornfall @ 2011-06-27 13:14 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: mornfall@sourceware.org 2011-06-27 13:14:53
Modified files:
daemons/common : daemon-client.c
Log message:
Do not open the socket with SOCK_NONBLOCK in daemon-client, since we have no
use for that behaviour (at least for now).
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/common/daemon-client.c.diff?cvsroot=lvm2&r1=1.1&r2=1.2
--- LVM2/daemons/common/daemon-client.c 2011/06/14 02:34:18 1.1
+++ LVM2/daemons/common/daemon-client.c 2011/06/27 13:14:53 1.2
@@ -5,11 +5,12 @@
#include <string.h>
#include <stdio.h>
#include <assert.h>
+#include <errno.h> // ENOMEM
daemon_handle daemon_open(daemon_info i) {
daemon_handle h;
struct sockaddr_un sockaddr;
- if ((h.socket_fd = socket(PF_UNIX, SOCK_STREAM | SOCK_NONBLOCK, 0)) < 0) {
+ if ((h.socket_fd = socket(PF_UNIX, SOCK_STREAM /* | SOCK_NONBLOCK */, 0)) < 0) {
perror("socket");
goto error;
}
@@ -50,5 +51,22 @@
return reply;
}
-void daemon_close(daemon_handle h) {
+daemon_reply daemon_send_simple(daemon_handle h, char *id, ...)
+{
+ va_list ap;
+ va_start(ap, id);
+ daemon_request rq = { .buffer = format_buffer(id, ap) };
+
+ if (!rq.buffer) {
+ daemon_reply err = { .error = ENOMEM, .buffer = NULL, .cft = NULL };
+ return err;
+ }
+
+ daemon_reply repl = daemon_send(h, rq);
+ dm_free(rq.buffer);
+ return repl;
+}
+
+void daemon_close(daemon_handle h)
+{
}
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-02-27 11:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-25 21:32 LVM2/daemons/common daemon-client.c zkabelac
-- strict thread matches above, loose matches on Subject: below --
2012-02-27 11:49 zkabelac
2012-02-24 0:02 mornfall
2012-02-15 9:14 mornfall
2011-06-27 13:14 mornfall
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).