Creating and applying patches

Create a patch
Make sure when creating a patchfile that you have the same number of directories levels for both the olddir path and newdir path.

Levels in the Patch Command (-p0 or -p1?)
The -p option will optionally strip off directory levels from the patchfile. For Ex: if you have a patchfile with a header as such:

--- old/modules/pcitable	Mon Sep 27 11:03:56 1999 +++ new/modules/pcitable	Tue Dec 19 20:05:41 2000

Using a -p0 will expect, from your current working directory, to find a subdirectory called "new", then "modules" below that, then the "pcitable" file below that.

Using a -p1 will strip off the 1st level from the path and will expect to find (from your current working directory) a directory called "modules", then a file called "pcitable". Patch will ignore the "new" directory mentioned in the header of the patchfile.

Using a -p2 will strip of the first two levels from the path. Patch will expect to find "pcitable" in the current working directory. Patch will ignore the "new" and "modules" directories mentioned in the header of the patchfile.

Using a -p3 in this example would not be a good thing. Patch probably wouldn't patch anything.