/[smeserver]/rpms/sudo/sme9/sudo-1.8.6p3-iologracecondition.patch
ViewVC logotype

Contents of /rpms/sudo/sme9/sudo-1.8.6p3-iologracecondition.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Thu Feb 4 19:44:13 2021 UTC (3 years, 8 months ago) by jpp
Branch: MAIN
CVS Tags: sudo-1_8_6p3-30_el6_sme, sudo-1_8_6p3-29_el6_9, HEAD
Sudo

1 diff -up ./plugins/sudoers/iolog.c.iologracecondition ./plugins/sudoers/iolog.c
2 --- ./plugins/sudoers/iolog.c.iologracecondition 2016-10-06 18:09:37.226616830 +0200
3 +++ ./plugins/sudoers/iolog.c 2016-10-06 18:20:28.930151862 +0200
4 @@ -118,11 +118,15 @@ mkdir_parents(char *path)
5 if ((slash = strchr(slash + 1, '/')) == NULL)
6 break;
7 *slash = '\0';
8 - if (stat(path, &sb) != 0) {
9 - if (mkdir(path, S_IRWXU) != 0)
10 + if (mkdir(path, S_IRWXU) != 0) {
11 + int mkdir_errno = errno;
12 + if (stat(path, &sb)) {
13 + errno = mkdir_errno;
14 log_fatal(USE_ERRNO, _("unable to mkdir %s"), path);
15 - } else if (!S_ISDIR(sb.st_mode)) {
16 - log_fatal(0, _("%s: %s"), path, strerror(ENOTDIR));
17 + }
18 + if (!S_ISDIR(sb.st_mode)) {
19 + log_fatal(0, _("%s: %s"), path, strerror(ENOTDIR));
20 + }
21 }
22 *slash = '/';
23 }
24 @@ -151,12 +155,16 @@ io_nextid(char *iolog_dir, char *iolog_d
25 * Create I/O log directory if it doesn't already exist.
26 */
27 mkdir_parents(iolog_dir);
28 - if (stat(iolog_dir, &sb) != 0) {
29 - if (mkdir(iolog_dir, S_IRWXU) != 0)
30 - log_fatal(USE_ERRNO, _("unable to mkdir %s"), iolog_dir);
31 - } else if (!S_ISDIR(sb.st_mode)) {
32 - log_fatal(0, _("%s exists but is not a directory (0%o)"),
33 + if (mkdir(iolog_dir, S_IRWXU) != 0) {
34 + int mkdir_errno = errno;
35 + if (stat(iolog_dir, &sb)) {
36 + errno = mkdir_errno;
37 + log_fatal(USE_ERRNO, _("unable to mkdir %s"), iolog_dir);
38 + }
39 + if (!S_ISDIR(sb.st_mode)) {
40 + log_fatal(0, _("%s exists but is not a directory (0%o)"),
41 iolog_dir, (unsigned int) sb.st_mode);
42 + }
43 }
44
45 /*

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed