- Fix error return in rootsymlink_generator.c

Update 1096-new-udev-root-symlink-generator.patch

- Fix error return in rootsymlink_generator.c
  Update 1096-new-udev-root-symlink-generator.patch

OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=824
This commit is contained in:
Robert Milasan 2014-11-25 09:47:17 +00:00 committed by Git OBS Bridge
parent 84c74da947
commit ba27807887
3 changed files with 20 additions and 7 deletions

View File

@ -32,7 +32,7 @@ Index: systemd-210/src/udev/rootsymlink_generator/rootsymlink_generator.c
=================================================================== ===================================================================
--- /dev/null --- /dev/null
+++ systemd-210/src/udev/rootsymlink_generator/rootsymlink_generator.c +++ systemd-210/src/udev/rootsymlink_generator/rootsymlink_generator.c
@@ -0,0 +1,64 @@ @@ -0,0 +1,65 @@
+/* +/*
+ * Copyright (C) 2014-2015 Robert Milasan <rmilasan@suse.com> + * Copyright (C) 2014-2015 Robert Milasan <rmilasan@suse.com>
+ * + *
@ -69,29 +69,30 @@ Index: systemd-210/src/udev/rootsymlink_generator/rootsymlink_generator.c
+ struct stat statbuf; + struct stat statbuf;
+ +
+ if (stat(_ROOTDEV_, &statbuf) != 0) + if (stat(_ROOTDEV_, &statbuf) != 0)
+ return -errno; + return 1;
+ +
+ if (major(statbuf.st_dev) > 0) { + if (major(statbuf.st_dev) > 0) {
+ int fd = -1; + int fd = -1;
+ char filename[BUFFER_SIZE]; + char filename[BUFFER_SIZE];
+ +
+ if (mkdir(_PATH_, 0755) != 0 && errno != EEXIST) + if (mkdir(_PATH_, 0755) != 0 && errno != EEXIST)
+ return -errno; + return errno;
+ +
+ snprintf(filename, BUFFER_SIZE, "%s/%s", _PATH_, _FILE_); + snprintf(filename, BUFFER_SIZE, "%s/%s", _PATH_, _FILE_);
+ +
+ if ((fd = open(filename, O_CREAT|O_WRONLY|O_TRUNC, 0644)) == -1) + if ((fd = open(filename, O_CREAT|O_WRONLY|O_TRUNC, 0644)) == -1)
+ return -errno; + return errno;
+ else { + else {
+ char buf[BUFFER_SIZE]; + char buf[BUFFER_SIZE];
+ +
+ snprintf(buf, BUFFER_SIZE, "ACTION==\"add|change\", SUBSYSTEM==\"block\", ENV{MAJOR}==\"%d\", ENV{MINOR}==\"%d\", SYMLINK+=\"root\"\n", + snprintf(buf, BUFFER_SIZE, "ACTION==\"add|change\", SUBSYSTEM==\"block\", ENV{MAJOR}==\"%d\", ENV{MINOR}==\"%d\", SYMLINK+=\"root\"\n",
+ major(statbuf.st_dev), minor(statbuf.st_dev)); + major(statbuf.st_dev), minor(statbuf.st_dev));
+ +
+ if (write(fd, buf, strlen(buf)) != strlen(buf)) + if (write(fd, buf, strlen(buf)) == -1)
+ return -errno; + return errno;
+ +
+ close(fd); + if (close(fd) == -1)
+ return errno;
+ } + }
+ } + }
+ +

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Nov 25 09:44:42 UTC 2014 - rmilasan@suse.com
- Fix error return in rootsymlink_generator.c
Update 1096-new-udev-root-symlink-generator.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Nov 21 13:35:40 UTC 2014 - werner@suse.de Fri Nov 21 13:35:40 UTC 2014 - werner@suse.de

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Nov 25 09:44:42 UTC 2014 - rmilasan@suse.com
- Fix error return in rootsymlink_generator.c
Update 1096-new-udev-root-symlink-generator.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Nov 21 13:35:40 UTC 2014 - werner@suse.de Fri Nov 21 13:35:40 UTC 2014 - werner@suse.de