Coding Guidelines/Safely Executing Other Processes

From wiki.zmanda.com
Revision as of 19:33, 22 May 2007 by Dustin (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

safe_cd

in common-src/file.c

Change the current working directory to a "safe" location. This is necessary for a variety of reasons:

  • Core files will be created in the working directory, so it should be writeable by the current user.
  • The current directory of a process represents an open file on that filesystem, preventing it from being unmounted. Best practices dictate that long-lived processes should cd to / or a well-known location.

safe_env

in common-src/alloc.c

Strip any unknown symbols from the environment. This protects the programs Amanda invokes from stray environment variables that might influence their operation.