Skip to content
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

conf: avoid spawning unnecessary subshells #2022

Merged
merged 1 commit into from Dec 13, 2017
Merged

conf: avoid spawning unnecessary subshells #2022

merged 1 commit into from Dec 13, 2017

Conversation

3XX0
Copy link
Contributor

@3XX0 3XX0 commented Dec 11, 2017

Signed-off-by: Jonathan Calmels jcalmels@nvidia.com

I'm not sure about the implications of this, this should be fine but @brauner might know better :)

@lxc-jenkins
Copy link

This pull request didn't trigger Jenkins as its author isn't in the whitelist.

An organization member must perform one of the following:

  • To have this branch tested by Jenkins, use the "ok to test" command.
  • To have a one time test done, use the "test this please" command.

Those commands are simple Github comments of the format: "jenkins: COMMAND"

Signed-off-by: Jonathan Calmels <jcalmels@nvidia.com>
@3XX0 3XX0 changed the title conf: avoid spwaning unnecessary subshells conf: avoid spawning unnecessary subshells Dec 12, 2017
@brauner
Copy link
Member

brauner commented Dec 12, 2017

I don't see obvious reasons to nack it. :) @stgraber?

@brauner
Copy link
Member

brauner commented Dec 12, 2017

jenkins: test this please

@stgraber stgraber merged commit d987c5d into lxc:master Dec 13, 2017
@@ -355,10 +355,11 @@ static int run_script_argv(const char *name, const char *section,

size += strlen(hook) + 1;

size += strlen("exec");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That escaped me that should be a static sizeof("exec"). Fixing this in #2026 since I need to touch that code anyway. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to use sizeof instead, it should be sizeof("exec") - 1. The compiler should be smart enough to do the right thing though

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to use sizeof instead, it should be sizeof("exec") - 1.

No, not really I'm just leaveing it as sizeof("exec") since this automatically accounts for the added ' '. In my branch I'm doing a size++ after each strlen(). In this case I'm just going to leave the sizeof() and not do a size++. But feel free to comment on the #2026. :)

The compiler should be smart enough to do the right thing though

Yeah, I agree but I like the code to reflect that this is information that is available statically.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, cleaner indeed ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants