summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 176a71f)
raw | patch | inline | side by side (parent: 176a71f)
author | Ruben Kerkhof <ruben@rubenkerkhof.com> | |
Tue, 29 Nov 2016 16:26:37 +0000 (17:26 +0100) | ||
committer | Ruben Kerkhof <ruben@rubenkerkhof.com> | |
Tue, 29 Nov 2016 16:26:37 +0000 (17:26 +0100) |
- No need to declare errno
- Remove one level of indentation
- Remove one level of indentation
contrib/docker/rootfs_prefix/rootfs_prefix.c | patch | blob | history |
diff --git a/contrib/docker/rootfs_prefix/rootfs_prefix.c b/contrib/docker/rootfs_prefix/rootfs_prefix.c
index c27a67afd12eeebfcc94dfba288c5a464bbe4373..65be0720b2ba9ea789a666945849b8ce4892ed7a 100644 (file)
#define BUFSIZE 256
const char *add_prefix(const char *orig, char *prefixed) {
- int status;
- int errno;
-
- if ((strncmp(orig, "/proc", 5) == 0) || (strncmp(orig, "/sys", 4) == 0)) {
-
- status = snprintf(prefixed, BUFSIZE, "%s%s", PREFIX, orig);
- if ((unsigned int)status >= BUFSIZE) {
- error(status, ENAMETOOLONG,
- "'%s' got truncated when adding '%s' prefix: '%s'", orig, PREFIX,
- prefixed);
- return orig;
- } else if (status < 1) {
- error(status, errno,
- "adding '%s' prefix to file path failed: '%s' -> '%s'", PREFIX,
- orig, prefixed);
- return orig;
- } else {
- return (const char *)prefixed;
- }
+ if ((strncmp(orig, "/proc", 5) != 0) && (strncmp(orig, "/sys", 4) != 0))
+ return orig;
- } else {
+ int status = snprintf(prefixed, BUFSIZE, "%s%s", PREFIX, orig);
+ if ((unsigned int)status >= BUFSIZE) {
+ error(status, ENAMETOOLONG,
+ "'%s' got truncated when adding '%s' prefix: '%s'", orig, PREFIX,
+ prefixed);
+ return orig;
+ } else if (status < 1) {
+ error(status, errno,
+ "adding '%s' prefix to file path failed: '%s' -> '%s'", PREFIX,
+ orig, prefixed);
return orig;
+ } else {
+ return (const char *)prefixed;
}
}