Commit Graph

34 Commits

Author SHA1 Message Date
Petr Uzel 75a94e8b36 uuidd: factor out socket creation into separate function
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2012-05-04 15:13:46 +02:00
Petr Uzel e1cf3ebed5 uuidd: implement --no-fork option
With this option, uuidd does not daemonize itself but stays
in the foreground.

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2012-05-04 15:13:45 +02:00
Petr Uzel f6f3dc7811 uuidd: use ignore_result helper
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2012-05-04 15:13:43 +02:00
Petr Uzel 0abfbd9ce6 uuidd: implement --no-pid option
With this option, uuidd does not create the PID file.

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2012-05-04 15:13:40 +02:00
Petr Uzel c453635572 uuidd: factor out pidfile creation into separate function
Introduce create_pidfile() function.

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2012-05-04 15:13:34 +02:00
Petr Uzel fcb09bf211 uuidd: remove useless initialization of cleanup_socket
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2012-05-04 15:13:28 +02:00
Petr Uzel 2e9b39eff3 uuidd: use UUIDD_OP_GETPID instead of magic number
Make parameters passed to call_daemon() more descriptive:
- use UUIDD_OP_GETPID instead of magic number 0
- call_daemon() takes pointer as a last argument, so pass NULL instead
  of 0

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2012-05-04 15:13:20 +02:00
Sami Kerola c05a80ca63 misc-utils: verify writing to streams was successful
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-04-04 19:56:48 +02:00
Petr Uzel 960cf5737e misc: use %m in format string instead of %s and strerror(errno)
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-09-27 15:46:07 +02:00
Eric Sandeen b747e88698 uuidd: Add missing break to option case statement
Specifying the "-n" option to uuidd would incorrectly
fall through to the "-p" case, and assign that number to
the pidfile_path.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
2011-09-27 15:08:34 +02:00
Karel Zak c63a92b828 uuidd: cleanup usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-16 12:48:23 +02:00
Benno Schulenberg 0149cd8468 uuidd: distinguish between singular and plural in three messages
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2011-08-02 14:13:44 +02:00
Karel Zak c3bfedc3d7 uuidd: fix compiler warnings [-Wsign-compare]
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-01 12:32:18 +02:00
Sami Kerola f7c297b839 uuidd: coding style fixes
Few unnecessary void casts removed, rest is about spacing.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-06-25 15:15:29 +02:00
Sami Kerola 2fb35353fd uuidd: remove goto statement
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-06-25 14:58:35 +02:00
Sami Kerola 41dc5bc097 uuidd: use symbolic exit and return values
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-06-25 14:53:50 +02:00
Sami Kerola ea091bed63 uuidd: die() function removed
The function is replaced with err().

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-06-25 14:46:47 +02:00
Sami Kerola f0ef0b58dc uuidd: long options & new usage
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-06-25 14:36:34 +02:00
Benno Schulenberg 3c06229414 uuidd: add "-q" to synopsis, order options alphabetically
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2011-03-08 13:14:48 +01:00
Petr Uzel 70b989c280 libuuid: rename uuid__generate_* to __uuid_generate_*
Having uuid_generate_time and uuid__generate_time at
the same time is confusing. These functions are exported,
but not part of the official API (used by uuidd only).

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-02-16 16:07:15 +01:00
Petr Uzel 0ee03a2867 uuidd: correctly report number of generated subsequent UUIDs
Before this change, "uuidd -t -n 1" reported
"6fd0672e-2f9b-11e0-b9c8-000feae00cb0 and subsequent 1 UUIDs".
That is two subsequent UUIDs, which is not correct.

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-02-08 15:22:07 +01:00
Petr Uzel 38cf50010f uuidd: fix -n usage
It does not make sense to request zero UUIDs - report error.

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-02-08 15:21:53 +01:00
Petr Uzel 2307a2b9ea uuidd: increase connection backlog size to SOMAXCONN
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-02-08 15:21:51 +01:00
Petr Uzel 386749317e uuidd: use write_all from include/writeall.h
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-02-08 15:21:50 +01:00
Petr Uzel 2d16924217 uuidd: use die() where possible
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-02-08 15:21:49 +01:00
Petr Uzel 83a4498d77 uuidd: use daemon(3) library function
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-02-08 15:21:46 +01:00
Petr Uzel a8f131986c uuidd: use UUID_STR_LEN and UUID_LEN
Use named constants for lentgh of UUID's binary and textual
representation, instead of magic numbers.

[kzak@redhat.com: - use sizeof(uuid_t) rather than hardcoded size]

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-08 15:03:13 +01:00
Petr Uzel 783140784a uuidd: use UUIDD_OP_BULK_*_UUID named constants
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-02-08 15:01:30 +01:00
Petr Uzel faab2be3f4 uuidd: fix uuidd -r -n 2
uuidd -r -n 2 failed with "Unexpected reply length from server 36".
Fixed by this patch.

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-02-08 15:01:26 +01:00
Benno Schulenberg e6b0611b46 messages: gettextize a few skipped or forgotten ones
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2010-06-14 11:19:19 +02:00
Benno Schulenberg 333ec74962 uuidd: spell the plural of "UUID" consistently as "UUIDs"
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2010-06-14 11:13:51 +02:00
Theodore Ts'o 3b90c50066 libuuid, uuidd: Avoid infinite loop while reading from the socket fd
If for some reason the uuidd daemon or the process calling uuidd
exited unexpectely, the read_all() function would end up looping
forever, either in uuidd or in libuuid.  Fix this terminating the loop
if no data can be read after five tries to read from the file
descriptor.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-06-30 23:26:09 -04:00
Theodore Ts'o fdb3e93ce9 uuidd: Avoid closing the server socket when calling create_daemon()
In the event that file descriptors 0-2 are closed when uuidd is
started, the server socket could be created as a file descriptor that
will get closed when create_daemon() tries detaching the uuidd daemon
from its controlling tty.   Avoid this case by using dup(2).

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-06-30 23:26:09 -04:00
Karel Zak 69045d3dba uuidd: new command (UUID daemon from e2fsprogs)
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-05-22 10:06:16 +02:00