-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add cmdline options -u, -d and -P #1349
Conversation
As far as I can see, the build checks are failing due to the different output of gerbera -h due to the added options. |
regarding the lint-clang-format check I would like to keep my formatting, since I find it more readable |
Hey, thanks for the PR 👍 The failing test you can fix by updating the content of |
As I have no Mac available perhaps someone could check if all uids, all gids are being changed to the requested user and additional groups are being set. I think they should if I understand the mac os manpages correctly. |
Looks good! The pidfile write can be simplfied using the fmtlib library: #include <fmt/os.h>
int main() {
auto out = fmt::output_file("guide.txt");
out.print("Don't {}", "Panic");
} |
strcat(pidstr, "\n"); | ||
|
||
// open the pidfile | ||
int pidfd = open(pidfile->c_str(), O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a function writeTextFile
in util/tools
which does the file work for you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will look into it within the next week.
Can we get this rebased @flya320? Then happy to merge it, we can fix it up once its in with further PRs. Otherwise keeping up with master branch changes is going to be annoying 😄 |
Sorry to say, what does rebase mean? What do I have to do? thorsten |
Your fork was taken at some time in the past, and the main branch has moved on since then (so we now have conflicts). Rebasing is the process of updating your branch to be taken from the latest code (moving the "base") The high level steps are:
|
Though, if you prefer, we can "squash" these commits into one and merge it without trouble. |
What is easier for you? |
Squashing is easiest as I can just press this green button |
Lets do squash then! Sorry that I do not have a clue about the inner workings of github. Thorsten |
@flya320 Thanks, its merged! If you are feeling generous a patch for the documentation (/docs) would be great 😄 |
Yes, I will add a doc patch. May take a few days though... |
Do you only need a patch for the website docs or is the manpage also kept up to date? |
* added option -P to write a pidfile * cleanup of includes needed for new cmdline options * update formatting of file * update file formatting * define _GNU_SOURCE if not defined by buildsystem * Mac OS X does the setting of gid/uid differently * Max OS X: setuid only has one argument * change due to additional cmdline switches * clang style changes and more comments * use stat instead of open to test for pidfile * stat needs to fail due to ENOENT * Correct wrong variable declaration
-u,user: drop to user USER after startup, also changing all groups to those of USER
-d,daemon: daemonize after startup
-P,pidfile: write a pidfile