main.c (1161642d2288f71549f0c9f89d09807ca251b58f) main.c (be3dd0e67482cddc67c80ea1d4a0ed5cb6ad7733)
1// SPDX-License-Identifier: Apache-2.0
2// Copyright (C) 2021 IBM Corp.
3
4/*
5 * debug-trigger listens for an external signal that the BMC is in some way unresponsive. When a
6 * signal is received it triggers a crash to collect debug data and reboots the system in the hope
7 * that it will recover.
8 *

--- 532 unchanged lines hidden (view full) ---

541 * look for it in /dev. This allows us to use %p (the devpath specifier) in the udev
542 * rule to pass the device of interest to the systemd unit.
543 */
544 strncpy(devpath, argv[optind], sizeof(devpath));
545 devpath[PATH_MAX - 1] = '\0';
546 devid = basename(devpath);
547
548 strncpy(devnode, "/dev/", sizeof(devnode));
1// SPDX-License-Identifier: Apache-2.0
2// Copyright (C) 2021 IBM Corp.
3
4/*
5 * debug-trigger listens for an external signal that the BMC is in some way unresponsive. When a
6 * signal is received it triggers a crash to collect debug data and reboots the system in the hope
7 * that it will recover.
8 *

--- 532 unchanged lines hidden (view full) ---

541 * look for it in /dev. This allows us to use %p (the devpath specifier) in the udev
542 * rule to pass the device of interest to the systemd unit.
543 */
544 strncpy(devpath, argv[optind], sizeof(devpath));
545 devpath[PATH_MAX - 1] = '\0';
546 devid = basename(devpath);
547
548 strncpy(devnode, "/dev/", sizeof(devnode));
549 strncat(devnode, devid, sizeof(devnode));
549 strncat(devnode, devid, sizeof(devnode) - strlen("/dev/"));
550 devnode[PATH_MAX - 1] = '\0';
551
552 if ((sourcefd = open(devnode, O_RDONLY)) == -1)
553 err(EXIT_FAILURE, "Failed to open source %s", devnode);
554
555 optind++;
556 }
557

--- 64 unchanged lines hidden ---
550 devnode[PATH_MAX - 1] = '\0';
551
552 if ((sourcefd = open(devnode, O_RDONLY)) == -1)
553 err(EXIT_FAILURE, "Failed to open source %s", devnode);
554
555 optind++;
556 }
557

--- 64 unchanged lines hidden ---