← Commit list

705c9b348

Denys Vlasenko
Denys Vlasenko
2026-02-02
SUCCESS Duration: 160s

Subject

devfsd: constify, code shrink

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0
gcc -Wp,-MD,applets/.usage.d -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer      -Iinclude -Iinclude -o applets/usage applets/usage.c

Build Log

(log yok)

Commit Diff GitHub →

miscutils/devfsd.c+4 -4
@@ -306,7 +306,7 @@ static struct config_entry_struct *last_config = NULL;
static char *mount_point = NULL;
static volatile int caught_signal = FALSE;
static volatile int caught_sighup = FALSE;
-static struct initial_symlink_struct {
+static const struct initial_symlink_struct {
const char *dest;
const char *name;
} initial_symlinks[] = {
@@ -413,7 +413,7 @@ int devfsd_main(int argc, char **argv)
int fd, proto_rev, count;
unsigned long event_mask = 0;
struct sigaction new_action;
- struct initial_symlink_struct *curr;
+ const struct initial_symlink_struct *curr;
if (argc < 2)
bb_show_usage();
@@ -1072,8 +1072,8 @@ static int copy_inode(const char *destpath, const struct stat *dest_stat,
if (fd < 0)
break;
un_addr.sun_family = AF_UNIX;
- snprintf(un_addr.sun_path, sizeof(un_addr.sun_path), "%s", destpath);
- val = bind(fd, (struct sockaddr *) &un_addr, (int) sizeof un_addr);
+ strncpy(un_addr.sun_path, destpath, sizeof(un_addr.sun_path));
+ val = bind(fd, (struct sockaddr *) &un_addr, (int)sizeof(un_addr));
close(fd);
if (val != 0 || chmod(destpath, new_mode & ~S_IFMT) != 0)
break;