--- patch_manager/patch_manager.module	2011-04-20 12:50:00.000000000 -0500
+++ patch_manager_new/patch_manager.module	2011-04-20 12:55:28.000000000 -0500
@@ -421,13 +421,16 @@ function patch_manager_runpatch($node, $
 
   // Run the command
   $patch = variable_get('patch_manager_path_patch', '/usr/bin/patch');
-  $cmd = sprintf('%s -p1 --verbose %s -d %s -i %s',
-    $patch,
-    $flags,
-    escapeshellarg($root),
-    escapeshellarg($patchfile)
-  );
-  exec($cmd, $output, $ret);
+  foreach (array('-p1', '-p0') as $pn) {
+    $cmd = sprintf('%s '.$pn.' --verbose %s -d %s -i %s',
+      $patch,
+      $flags,
+      escapeshellarg($root),
+      escapeshellarg($patchfile)
+    );
+    exec($cmd, $output, $ret);
+    if (!$ret) break;
+  }
   watchdog('patch_manager', 'Ran shell command (%command) which finished with status @status', array('%command' => $cmd, '@status' => $ret));
 
   // Return the results
