mirror of
https://github.com/AuxXxilium/eudev.git
synced 2024-12-28 06:35:34 +07:00
sd-daemon: remove unnecessary memset calls
There is no point in clearing the bits of a "struct stat" when the very next statement just calls stat or fstat to fill in that same memory. [zj: two more places]
This commit is contained in:
parent
17804d7f0a
commit
956b78e8e3
@ -2287,7 +2287,6 @@ static int load_from_path(Unit *u, const char *path) {
|
|||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
zero(st);
|
|
||||||
if (fstat(fileno(f), &st) < 0) {
|
if (fstat(fileno(f), &st) < 0) {
|
||||||
r = -errno;
|
r = -errno;
|
||||||
goto finish;
|
goto finish;
|
||||||
|
@ -564,7 +564,6 @@ static int service_load_sysv_path(Service *s, const char *path) {
|
|||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
zero(st);
|
|
||||||
if (fstat(fileno(f), &st) < 0) {
|
if (fstat(fileno(f), &st) < 0) {
|
||||||
r = -errno;
|
r = -errno;
|
||||||
goto finish;
|
goto finish;
|
||||||
|
@ -152,7 +152,6 @@ _sd_export_ int sd_is_fifo(int fd, const char *path) {
|
|||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
memset(&st_fd, 0, sizeof(st_fd));
|
|
||||||
if (fstat(fd, &st_fd) < 0)
|
if (fstat(fd, &st_fd) < 0)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
@ -162,7 +161,6 @@ _sd_export_ int sd_is_fifo(int fd, const char *path) {
|
|||||||
if (path) {
|
if (path) {
|
||||||
struct stat st_path;
|
struct stat st_path;
|
||||||
|
|
||||||
memset(&st_path, 0, sizeof(st_path));
|
|
||||||
if (stat(path, &st_path) < 0) {
|
if (stat(path, &st_path) < 0) {
|
||||||
|
|
||||||
if (errno == ENOENT || errno == ENOTDIR)
|
if (errno == ENOENT || errno == ENOTDIR)
|
||||||
|
Loading…
Reference in New Issue
Block a user