Jim Meyering <j...@meyering.net> writes: > William Douglas wrote: > > Hello, > I notice that other code in this file does the same thing, > so maybe you're just following that example, but why bother > to clear the bits of a struct stat before calling fstat or stat > to fill it in? > > Aren't the two memset calls here unnecessary? You are completely correct, I'll change those thanks!
> >> + if (!S_ISREG(st_fd.st_mode)) >> + return 0; >> + >> + if (path) { >> + struct stat st_path; >> + >> + memset(&st_path, 0, sizeof(st_path)); >> + if (stat(path, &st_path) < 0) { >> + >> + if (errno == ENOENT || errno == ENOTDIR) >> + return 0; >> + >> + return -errno; >> + } >> + >> + return >> + st_path.st_dev == st_fd.st_dev && >> + st_path.st_ino == st_fd.st_ino; >> + } >> + >> + return 1; >> +} -- William Douglas, Intel Open Source Technology Center _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel