coredump: use 'input_fd' name for the pipe fd passed by the kernel everywhere
authorFranck Bui <fbui@suse.com>
Fri, 28 Jun 2019 04:52:07 +0000 (06:52 +0200)
committerFranck Bui <fbui@suse.com>
Tue, 16 Jul 2019 15:39:19 +0000 (17:39 +0200)
'input_fd' variable name is used mostly everywhere except in process_socket()
where it's named 'coredump_fd', which is pretty confusing since 'coredump_fd'
is used for the coredump filename in submit_coredump().

So let's use 'input_fd' consistently as name for the pipe fd passed by the
kernel.

No functional changes.

src/coredump/coredump.c

index f81ae3b..0ad2f51 100644 (file)
@@ -847,7 +847,7 @@ static void map_context_fields(const struct iovec *iovec, const char* context[])
 }
 
 static int process_socket(int fd) {
-        _cleanup_close_ int coredump_fd = -1;
+        _cleanup_close_ int input_fd = -1;
         const char *context[_CONTEXT_MAX] = {};
         struct iovec_wrapper iovw = {};
         struct iovec iovec;
@@ -917,8 +917,8 @@ static int process_socket(int fd) {
                                 goto finish;
                         }
 
-                        assert(coredump_fd < 0);
-                        coredump_fd = *(int*) CMSG_DATA(found);
+                        assert(input_fd < 0);
+                        input_fd = *(int*) CMSG_DATA(found);
                         break;
                 }
 
@@ -943,7 +943,7 @@ static int process_socket(int fd) {
         assert(context[CONTEXT_RLIMIT]);
         assert(context[CONTEXT_HOSTNAME]);
         assert(context[CONTEXT_COMM]);
-        assert(coredump_fd >= 0);
+        assert(input_fd >= 0);
 
         /* Small quirk: the journal fields contain the timestamp padded with six zeroes,
          * so that the kernel-supplied 1s granularity timestamps becomes 1µs granularity,
@@ -953,7 +953,7 @@ static int process_socket(int fd) {
         if (k > 6)
                 context[CONTEXT_TIMESTAMP] = strndupa(context[CONTEXT_TIMESTAMP], k - 6);
 
-        r = submit_coredump(context, &iovw, coredump_fd);
+        r = submit_coredump(context, &iovw, input_fd);
 
 finish:
         iovw_free_contents(&iovw, true);