Created
June 11, 2012 09:08
-
-
Save checko/2909197 to your computer and use it in GitHub Desktop.
mount and run script on external sd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sys/mount.h> | |
#include <sys/stat.h> | |
#include <unistd.h> | |
#include <stdio.h> | |
int main(int argc,char **argv) | |
{ | |
int fd; | |
struct stat s; | |
if(mount("/dev/block/mmcblk1p1","/extsd","vfat",0,NULL)){ | |
printf("mount fail!\n"); | |
return 0; | |
} | |
if(stat("/extsd/ss.sh",&s)==0) | |
{ | |
char *a[]={"/extsd/sh","/extsd/ss.sh",NULL}; | |
execv("/extsd/sh",a); | |
} | |
umountexit: | |
//===umount and exit | |
umount("/extsd"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment