chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
util: unify how we see srand()
[elogind.git]
/
src
/
udev
/
scsi_id
/
scsi_serial.c
diff --git
a/src/udev/scsi_id/scsi_serial.c
b/src/udev/scsi_id/scsi_serial.c
index 2f2afcee6edfea097b8ba9ada823be2c605708c5..933867159118162287138c9ea1ea2c1be3d6d50c 100644
(file)
--- a/
src/udev/scsi_id/scsi_serial.c
+++ b/
src/udev/scsi_id/scsi_serial.c
@@
-26,7
+26,6
@@
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
-#include <syslog.h>
#include <time.h>
#include <inttypes.h>
#include <scsi/scsi.h>
#include <time.h>
#include <inttypes.h>
#include <scsi/scsi.h>
@@
-818,7
+817,7
@@
int scsi_std_inquiry(struct udev *udev,
struct stat statbuf;
int err = 0;
struct stat statbuf;
int err = 0;
- fd = open(devname, O_RDONLY | O_NONBLOCK);
+ fd = open(devname, O_RDONLY | O_NONBLOCK
| O_CLOEXEC
);
if (fd < 0) {
log_debug("scsi_id: cannot open %s: %m", devname);
return 1;
if (fd < 0) {
log_debug("scsi_id: cannot open %s: %m", devname);
return 1;
@@
-862,11
+861,11
@@
int scsi_get_serial(struct udev *udev,
int retval;
memzero(dev_scsi->serial, len);
int retval;
memzero(dev_scsi->serial, len);
-
srand((unsigned int)getpid()
);
+
initialize_srand(
);
for (cnt = 20; cnt > 0; cnt--) {
struct timespec duration;
for (cnt = 20; cnt > 0; cnt--) {
struct timespec duration;
- fd = open(devname, O_RDONLY | O_NONBLOCK);
+ fd = open(devname, O_RDONLY | O_NONBLOCK
| O_CLOEXEC
);
if (fd >= 0 || errno != EBUSY)
break;
duration.tv_sec = 0;
if (fd >= 0 || errno != EBUSY)
break;
duration.tv_sec = 0;