diff options
author | Lennart Poettering <lennart@poettering.net> | 2023-04-14 12:48:14 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2023-04-14 16:56:15 +0200 |
commit | d791013ff529cbbb74d4cc5f1455f172befab1e6 (patch) | |
tree | a52a2742502f99537ba58cdae318336c89687aba /src/basic/mountpoint-util.c | |
parent | Merge pull request #27252 from yuwata/chase-mkdir (diff) | |
download | systemd-d791013ff529cbbb74d4cc5f1455f172befab1e6.tar.xz systemd-d791013ff529cbbb74d4cc5f1455f172befab1e6.zip |
string-util: add strstrafter()
strstrafter() is like strstr() but returns a pointer to the first
character *after* the found substring, not on the substring itself.
Quite often this is what we actually want.
Inspired by #27267 I think it makes sense to add a helper for this,
to avoid the potentially fragile manual pointer increment afterwards.
Diffstat (limited to 'src/basic/mountpoint-util.c')
-rw-r--r-- | src/basic/mountpoint-util.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/basic/mountpoint-util.c b/src/basic/mountpoint-util.c index 751d5a35ce..027e64c498 100644 --- a/src/basic/mountpoint-util.c +++ b/src/basic/mountpoint-util.c @@ -559,12 +559,12 @@ int dev_is_devtmpfs(void) { if (mid != mount_id) continue; - e = strstr(line, " - "); + e = strstrafter(line, " - "); if (!e) continue; /* accept any name that starts with the currently expected type */ - if (startswith(e + 3, "devtmpfs")) + if (startswith(e, "devtmpfs")) return true; } |