All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] uuidd: require use of --socket-activation when run as systemd service
@ 2016-08-03 22:41 Sami Kerola
  2016-08-03 22:41 ` [PATCH 2/2] uuidd: remove unnecessary pidpile path variable Sami Kerola
  2016-08-08 10:22 ` [PATCH 1/2] uuidd: require use of --socket-activation when run as systemd service Karel Zak
  0 siblings, 2 replies; 5+ messages in thread
From: Sami Kerola @ 2016-08-03 22:41 UTC (permalink / raw)
  To: util-linux; +Cc: Sami Kerola

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 misc-utils/uuidd.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/misc-utils/uuidd.c b/misc-utils/uuidd.c
index a3fe830..77c967d 100644
--- a/misc-utils/uuidd.c
+++ b/misc-utils/uuidd.c
@@ -651,6 +651,13 @@ int main(int argc, char **argv)
 	else if (pidfile_path_param)
 		pidfile_path = pidfile_path_param;
 
+#ifdef HAVE_LIBSYSTEMD
+	if (getppid() == 1 && 0 < sd_booted() &&
+	    (!uuidd_cxt.no_sock || !uuidd_cxt.no_fork || !no_pid))
+		errx(EXIT_FAILURE,  _("cannot run as systemd service "
+				      "without --socket-activation"));
+#endif
+
 	/* custom socket path and socket-activation make no sense */
 	if (s_flag && uuidd_cxt.no_sock && !uuidd_cxt.quiet)
 		warnx(_("Both --socket-activation and --socket specified. "
-- 
2.9.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] uuidd: remove unnecessary pidpile path variable
  2016-08-03 22:41 [PATCH 1/2] uuidd: require use of --socket-activation when run as systemd service Sami Kerola
@ 2016-08-03 22:41 ` Sami Kerola
  2016-08-08 10:34   ` Karel Zak
  2016-08-08 10:22 ` [PATCH 1/2] uuidd: require use of --socket-activation when run as systemd service Karel Zak
  1 sibling, 1 reply; 5+ messages in thread
From: Sami Kerola @ 2016-08-03 22:41 UTC (permalink / raw)
  To: util-linux; +Cc: Sami Kerola

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 misc-utils/uuidd.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/misc-utils/uuidd.c b/misc-utils/uuidd.c
index 77c967d..dce12c0 100644
--- a/misc-utils/uuidd.c
+++ b/misc-utils/uuidd.c
@@ -543,7 +543,6 @@ int main(int argc, char **argv)
 {
 	const char	*socket_path = UUIDD_SOCKET_PATH;
 	const char	*pidfile_path = NULL;
-	const char	*pidfile_path_param = NULL;
 	const char	*err_context = NULL;
 	char		buf[1024], *cp;
 	char		str[UUID_STR_LEN];
@@ -601,7 +600,7 @@ int main(int argc, char **argv)
 						_("failed to parse --uuids"));
 			break;
 		case 'p':
-			pidfile_path_param = optarg;
+			pidfile_path = optarg;
 			break;
 		case 'P':
 			no_pid = 1;
@@ -646,10 +645,8 @@ int main(int argc, char **argv)
 		}
 	}
 
-	if (!no_pid && !pidfile_path_param)
+	if (!no_pid && !pidfile_path)
 		pidfile_path = UUIDD_PIDFILE_PATH;
-	else if (pidfile_path_param)
-		pidfile_path = pidfile_path_param;
 
 #ifdef HAVE_LIBSYSTEMD
 	if (getppid() == 1 && 0 < sd_booted() &&
-- 
2.9.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] uuidd: require use of --socket-activation when run as systemd service
  2016-08-03 22:41 [PATCH 1/2] uuidd: require use of --socket-activation when run as systemd service Sami Kerola
  2016-08-03 22:41 ` [PATCH 2/2] uuidd: remove unnecessary pidpile path variable Sami Kerola
@ 2016-08-08 10:22 ` Karel Zak
  2016-08-12 21:29   ` Sami Kerola
  1 sibling, 1 reply; 5+ messages in thread
From: Karel Zak @ 2016-08-08 10:22 UTC (permalink / raw)
  To: Sami Kerola; +Cc: util-linux

On Wed, Aug 03, 2016 at 11:41:57PM +0100, Sami Kerola wrote:
> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
> ---
>  misc-utils/uuidd.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/misc-utils/uuidd.c b/misc-utils/uuidd.c
> index a3fe830..77c967d 100644
> --- a/misc-utils/uuidd.c
> +++ b/misc-utils/uuidd.c
> @@ -651,6 +651,13 @@ int main(int argc, char **argv)
>  	else if (pidfile_path_param)
>  		pidfile_path = pidfile_path_param;
>  
> +#ifdef HAVE_LIBSYSTEMD
> +	if (getppid() == 1 && 0 < sd_booted() &&
> +	    (!uuidd_cxt.no_sock || !uuidd_cxt.no_fork || !no_pid))
> +		errx(EXIT_FAILURE,  _("cannot run as systemd service "
> +				      "without --socket-activation"));
> +#endif

 Why? 
 
 I do not test it, but I guess --socket-activation is always an
 optional way. It's enabled by default in systemd unit files, but I
 guess for some test purpose you can use old way to start uuid
 independently on your initd. Right?

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] uuidd: remove unnecessary pidpile path variable
  2016-08-03 22:41 ` [PATCH 2/2] uuidd: remove unnecessary pidpile path variable Sami Kerola
@ 2016-08-08 10:34   ` Karel Zak
  0 siblings, 0 replies; 5+ messages in thread
From: Karel Zak @ 2016-08-08 10:34 UTC (permalink / raw)
  To: Sami Kerola; +Cc: util-linux

On Wed, Aug 03, 2016 at 11:41:58PM +0100, Sami Kerola wrote:
>  misc-utils/uuidd.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)

 Applied, thanks.

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] uuidd: require use of --socket-activation when run as systemd service
  2016-08-08 10:22 ` [PATCH 1/2] uuidd: require use of --socket-activation when run as systemd service Karel Zak
@ 2016-08-12 21:29   ` Sami Kerola
  0 siblings, 0 replies; 5+ messages in thread
From: Sami Kerola @ 2016-08-12 21:29 UTC (permalink / raw)
  To: Karel Zak; +Cc: util-linux

On Mon, 8 Aug 2016, Karel Zak wrote:

> On Wed, Aug 03, 2016 at 11:41:57PM +0100, Sami Kerola wrote:
> > Signed-off-by: Sami Kerola <kerolasa@iki.fi>
> > ---
> >  misc-utils/uuidd.c | 7 +++++++
> >  1 file changed, 7 insertions(+)
> > 
> > diff --git a/misc-utils/uuidd.c b/misc-utils/uuidd.c
> > index a3fe830..77c967d 100644
> > --- a/misc-utils/uuidd.c
> > +++ b/misc-utils/uuidd.c
> > @@ -651,6 +651,13 @@ int main(int argc, char **argv)
> >  	else if (pidfile_path_param)
> >  		pidfile_path = pidfile_path_param;
> >  
> > +#ifdef HAVE_LIBSYSTEMD
> > +	if (getppid() == 1 && 0 < sd_booted() &&
> > +	    (!uuidd_cxt.no_sock || !uuidd_cxt.no_fork || !no_pid))
> > +		errx(EXIT_FAILURE,  _("cannot run as systemd service "
> > +				      "without --socket-activation"));
> > +#endif
> 
>  Why? 
>  
>  I do not test it, but I guess --socket-activation is always an
>  optional way. It's enabled by default in systemd unit files, but I
>  guess for some test purpose you can use old way to start uuid
>  independently on your initd. Right?

My thinking with this was that when software can detect correct
invocation it should. In this case when uuidd is started by
systemd then incorrect option usage in service file should
cause an error.

But indeed, perhaps an unnecessary change so I'm not going to
push this any further.

-- 
Sami Kerola
http://www.iki.fi/kerolasa/

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-08-12 21:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-03 22:41 [PATCH 1/2] uuidd: require use of --socket-activation when run as systemd service Sami Kerola
2016-08-03 22:41 ` [PATCH 2/2] uuidd: remove unnecessary pidpile path variable Sami Kerola
2016-08-08 10:34   ` Karel Zak
2016-08-08 10:22 ` [PATCH 1/2] uuidd: require use of --socket-activation when run as systemd service Karel Zak
2016-08-12 21:29   ` Sami Kerola

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.